From 617734f23bd51ad5a57c9bc9859c88ebcdb7aa6d Mon Sep 17 00:00:00 2001 From: tian-lt Date: Wed, 2 Jun 2021 13:27:10 +0800 Subject: [PATCH 1/3] #DEBUG is a known C# preprocessor directive --- src/Calculator/App.xaml.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Calculator/App.xaml.cs b/src/Calculator/App.xaml.cs index 79b7d038c..d5bed05de 100644 --- a/src/Calculator/App.xaml.cs +++ b/src/Calculator/App.xaml.cs @@ -59,7 +59,6 @@ public App() Suspending += OnSuspending; - // CSHARP_MIGRATION: TODO: #if DEBUG DebugSettings.IsBindingTracingEnabled = true; DebugSettings.BindingFailed += (sender, args) => From fd5a38acd94c3f0bf9089660dfce7f0f7c5314e4 Mon Sep 17 00:00:00 2001 From: tian-lt Date: Wed, 2 Jun 2021 13:32:18 +0800 Subject: [PATCH 2/3] So far, we haven't observed the problem described in the comment from C# async --- src/Calculator/App.xaml.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Calculator/App.xaml.cs b/src/Calculator/App.xaml.cs index d5bed05de..37251976c 100644 --- a/src/Calculator/App.xaml.cs +++ b/src/Calculator/App.xaml.cs @@ -398,8 +398,6 @@ public void Dispose() 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 From c6cbca004afa9c708fecc586451fee622fc5f3ff Mon Sep 17 00:00:00 2001 From: tian-lt Date: Wed, 2 Jun 2021 17:47:38 +0800 Subject: [PATCH 3/3] fixes misc TODO items --- .../Common/DisplayExpressionToken.h | 5 +---- src/CalcViewModel/StandardCalculatorViewModel.h | 4 ++-- src/CalcViewModel/UnitConverterViewModel.h | 16 +++++++--------- src/Calculator/App.xaml.cs | 2 -- src/Calculator/Common/KeyboardShortcuManager.cs | 6 +++--- src/Calculator/Views/Calculator.xaml.cs | 2 -- .../CalculatorProgrammerBitFlipPanel.xaml.cs | 3 --- src/Calculator/Views/DateCalculator.xaml.cs | 2 -- src/Calculator/Views/MainPage.xaml.cs | 2 +- 9 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/CalcViewModel/Common/DisplayExpressionToken.h b/src/CalcViewModel/Common/DisplayExpressionToken.h index 86aed75f6..c53c48578 100644 --- a/src/CalcViewModel/Common/DisplayExpressionToken.h +++ b/src/CalcViewModel/Common/DisplayExpressionToken.h @@ -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; }; diff --git a/src/CalcViewModel/StandardCalculatorViewModel.h b/src/CalcViewModel/StandardCalculatorViewModel.h index edae788d6..ac5e877b6 100644 --- a/src/CalcViewModel/StandardCalculatorViewModel.h +++ b/src/CalcViewModel/StandardCalculatorViewModel.h @@ -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); diff --git a/src/CalcViewModel/UnitConverterViewModel.h b/src/CalcViewModel/UnitConverterViewModel.h index 3e26f1237..594742ecc 100644 --- a/src/CalcViewModel/UnitConverterViewModel.h +++ b/src/CalcViewModel/UnitConverterViewModel.h @@ -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); diff --git a/src/Calculator/App.xaml.cs b/src/Calculator/App.xaml.cs index 37251976c..ac0006f22 100644 --- a/src/Calculator/App.xaml.cs +++ b/src/Calculator/App.xaml.cs @@ -402,14 +402,12 @@ 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) diff --git a/src/Calculator/Common/KeyboardShortcuManager.cs b/src/Calculator/Common/KeyboardShortcuManager.cs index aebc04471..0f9213189 100644 --- a/src/Calculator/Common/KeyboardShortcuManager.cs +++ b/src/Calculator/Common/KeyboardShortcuManager.cs @@ -617,7 +617,7 @@ private static void OnKeyDownHandler(CoreWindow sender, KeyEventArgs args) } 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 @@ private static void OnKeyDownHandler(CoreWindow sender, KeyEventArgs args) } 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 @@ private static void OnAcceleratorKeyActivated(CoreDispatcher dispatcher, Acceler 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)navView.MenuItemsSource); if (menuItems != null) diff --git a/src/Calculator/Views/Calculator.xaml.cs b/src/Calculator/Views/Calculator.xaml.cs index 00407246e..6abc1b013 100644 --- a/src/Calculator/Views/Calculator.xaml.cs +++ b/src/Calculator/Views/Calculator.xaml.cs @@ -458,8 +458,6 @@ private void OnIsInErrorPropertyChanged() { ScientificAngleButtons.IsErrorVisualState = isError; } - // CSHARP_MIGRATION: TODO: - // ScientificAngleButtons works but ProgrammerDisplayPanel doesn't else if (IsProgrammer && ProgrammerDisplayPanel != null) { ProgrammerDisplayPanel.IsErrorVisualState = isError; diff --git a/src/Calculator/Views/CalculatorProgrammerBitFlipPanel.xaml.cs b/src/Calculator/Views/CalculatorProgrammerBitFlipPanel.xaml.cs index e327734f9..22642be82 100644 --- a/src/Calculator/Views/CalculatorProgrammerBitFlipPanel.xaml.cs +++ b/src/Calculator/Views/CalculatorProgrammerBitFlipPanel.xaml.cs @@ -227,9 +227,6 @@ private void UpdateCheckedStates(bool updateAutomationPropertiesNames) } 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); diff --git a/src/Calculator/Views/DateCalculator.xaml.cs b/src/Calculator/Views/DateCalculator.xaml.cs index 422453f6a..8d2539c06 100644 --- a/src/Calculator/Views/DateCalculator.xaml.cs +++ b/src/Calculator/Views/DateCalculator.xaml.cs @@ -223,8 +223,6 @@ private void AddSubtractOption_Checked(object sender, RoutedEventArgs e) 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 diff --git a/src/Calculator/Views/MainPage.xaml.cs b/src/Calculator/Views/MainPage.xaml.cs index b3cfebda1..b4afa3483 100644 --- a/src/Calculator/Views/MainPage.xaml.cs +++ b/src/Calculator/Views/MainPage.xaml.cs @@ -116,7 +116,7 @@ public void SetHeaderAutomationName() public ObservableCollection CreateUIElementsForCategories(IObservableVector categories) { - var menuCategories = new ObservableCollection(); // CSHARP_MIGRATION: TODO: Check if ObservableCollection fits here + var menuCategories = new ObservableCollection(); foreach (var group in categories) {