Fixes up some simple miscellaneous TODO items (#1556)

* #DEBUG is a known C# preprocessor directive

* So far, we haven't observed the problem described in the comment from C# async

* fixes misc TODO items
This commit is contained in:
Tian L 2021-06-03 18:04:40 +08:00 committed by GitHub
commit ce5a1cb280
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 14 additions and 31 deletions

View file

@ -33,6 +33,7 @@ public
OBSERVABLE_PROPERTY_RW(int, TokenPosition);
OBSERVABLE_PROPERTY_RW(bool, IsTokenEditable);
OBSERVABLE_PROPERTY_RW(int, CommandIndex);
OBSERVABLE_PROPERTY_RW(TokenType, Type);
OBSERVABLE_PROPERTY_R(Platform::String ^, OriginalToken);
property bool IsTokenInEditMode
@ -51,10 +52,6 @@ public
}
}
// CSHARP_MIGRATION: TODO: this property has been changed from Internal to Public
// double check if this change is reasonable
OBSERVABLE_PROPERTY_RW(TokenType, Type);
private:
bool m_InEditMode;
};

View file

@ -245,13 +245,13 @@ namespace CalculatorApp
void SendCommandToCalcManager(int command);
public:
// CSHARP_MIGRATION: TODO: check if these still need to be internal
// Memory feature related methods. They are internal because they need to called from the MainPage code-behind
// Memory feature related methods.
void OnMemoryButtonPressed();
void OnMemoryItemPressed(Platform::Object ^ memoryItemPosition);
void OnMemoryAdd(Platform::Object ^ memoryItemPosition);
void OnMemorySubtract(Platform::Object ^ memoryItemPosition);
void OnMemoryClear(_In_ Platform::Object ^ memoryItemPosition);
void SelectHistoryItem(HistoryItemViewModel ^ item);
void SwitchProgrammerModeBase(CalculatorApp::ViewModel::Common::NumberBase calculatorBase);
void SetBitshiftRadioButtonCheckedAnnouncement(Platform::String ^ announcement);

View file

@ -75,7 +75,6 @@ namespace CalculatorApp
return AccessibleName;
}
// CSHARP_MIGRATION: TODO:
public:
bool IsModelUnitWhimsical()
{
@ -87,10 +86,11 @@ namespace CalculatorApp
return m_original.id;
}
internal : const UnitConversionManager::Unit& GetModelUnit() const
{
return m_original;
}
internal:
const UnitConversionManager::Unit& GetModelUnit() const
{
return m_original;
}
private:
const UnitConversionManager::Unit m_original;
@ -98,23 +98,21 @@ namespace CalculatorApp
[Windows::UI::Xaml::Data::Bindable] public ref class SupplementaryResult sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
{
internal : SupplementaryResult(Platform::String ^ value, Unit ^ unit)
internal:
SupplementaryResult(Platform::String ^ value, Unit ^ unit)
: m_Value(value)
, m_Unit(unit)
{
}
// CSHARP_MIGRATION: TODO: double check below method's accessor
public:
bool IsWhimsical()
{
return m_Unit->GetModelUnit().isWhimsical;
}
public:
Platform::String ^ GetLocalizedAutomationName();
public:
OBSERVABLE_OBJECT();
OBSERVABLE_PROPERTY_R(Platform::String ^, Value);

View file

@ -59,7 +59,6 @@ namespace CalculatorApp
Suspending += OnSuspending;
// CSHARP_MIGRATION: TODO:
#if DEBUG
DebugSettings.IsBindingTracingEnabled = true;
DebugSettings.BindingFailed += (sender, args) =>
@ -399,20 +398,16 @@ namespace CalculatorApp
private App m_parent;
};
// CSHARP_MIGRATION: TODO: check what is the pragma used for???
//#pragma optimize("", off) // Turn off optimizations to work around coroutine optimization bug
private async Task SetupJumpList()
{
try
{
// CSHARP_MIGRATION: TODO:
var calculatorOptions = NavCategoryGroup.CreateCalculatorCategory();
var jumpList = await JumpList.LoadCurrentAsync();
jumpList.SystemGroupKind = JumpListSystemGroupKind.None;
jumpList.Items.Clear();
// CSHARP_MIGRATION: TODO:
foreach (NavCategory option in calculatorOptions.Categories)
{
if (!option.IsEnabled)

View file

@ -617,7 +617,7 @@ namespace CalculatorApp
}
var buttons = EqualRange(lookupMap, (MyVirtualKey)key);
var navView = buttons.ElementAt(0).Target as MUXC.NavigationView; // CSHARP_MIGRATION: TODO: double check if button[0] exists
var navView = buttons.ElementAt(0).Target as MUXC.NavigationView;
var appViewModel = (navView.DataContext as ApplicationViewModel);
appViewModel.Mode = ViewMode.Date;
var categoryName = AppResourceProvider.GetInstance().GetResourceString("DateCalculationModeText");
@ -656,7 +656,7 @@ namespace CalculatorApp
}
var buttons = EqualRange(lookupMap, (MyVirtualKey)myVirtualKey);
if (buttons.Count() <= 0) // CSHARP_MIGRATION: TODO: double check if this is equivalent to `if (buttons.first == buttons.second)`
if (buttons.Count() <= 0)
{
return;
}
@ -710,7 +710,7 @@ namespace CalculatorApp
var item = itemRef.Target as MUXC.NavigationView;
if (item != null)
{
var navView = item as MUXC.NavigationView; // CSHARP_MIGRATION: TODO: check if this line is still needed
var navView = (MUXC.NavigationView)item;
var menuItems = ((ObservableCollection<object>)navView.MenuItemsSource);
if (menuItems != null)

View file

@ -458,8 +458,6 @@ namespace CalculatorApp
{
ScientificAngleButtons.IsErrorVisualState = isError;
}
// CSHARP_MIGRATION: TODO:
// ScientificAngleButtons works but ProgrammerDisplayPanel doesn't
else if (IsProgrammer && ProgrammerDisplayPanel != null)
{
ProgrammerDisplayPanel.IsErrorVisualState = isError;

View file

@ -227,9 +227,6 @@ namespace CalculatorApp
}
m_updatingCheckedStates = true;
// CSHARP_MIGRATION:
// iterator and index move at the same time with same step
// add index validation in the loop
int index = 0;
bool mustUpdateTextOfMostSignificantDigits = m_currentValueBitLength != Model.ValueBitLength;
int previousMSDPosition = GetIndexOfLastBit(m_currentValueBitLength);

View file

@ -223,8 +223,6 @@ namespace CalculatorApp
RaiseLiveRegionChangedAutomationEvent(false);
}
// CSHARP_MIGRATION: TODO:
// can we change the calendarDatePicker.Date of in arg?
private void ReselectCalendarDate(CalendarDatePicker calendarDatePicker, DateTimeOffset? dateTime)
{
// Reselect the unselected Date

View file

@ -116,7 +116,7 @@ namespace CalculatorApp
public ObservableCollection<object> CreateUIElementsForCategories(IObservableVector<NavCategoryGroup> categories)
{
var menuCategories = new ObservableCollection<object>(); // CSHARP_MIGRATION: TODO: Check if ObservableCollection fits here
var menuCategories = new ObservableCollection<object>();
foreach (var group in categories)
{