Removed AppBar, OperatorTextBox and OperandTextBox controls (#440)

Fixes #407 
Removed AppBar, OperatorTextBox and OperandTextBox controls
This commit is contained in:
jatinkumar 2019-04-16 20:46:07 -04:00 committed by Daniel Belcher
parent 7a7ceb5888
commit c150cd4ece
14 changed files with 1 additions and 328 deletions

View File

@ -36,7 +36,6 @@ namespace
{
StringReference CategoriesPropertyName(L"Categories");
StringReference ClearMemoryVisibilityPropertyName(L"ClearMemoryVisibility");
StringReference AppBarVisibilityPropertyName(L"AppBarVisibility");
}
ApplicationViewModel::ApplicationViewModel() :
@ -164,7 +163,6 @@ void ApplicationViewModel::OnModeChanged()
TraceLogger::GetInstance().LogModeChangeEnd(m_mode, ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()));
RaisePropertyChanged(ClearMemoryVisibilityPropertyName);
RaisePropertyChanged(AppBarVisibilityPropertyName);
}
void ApplicationViewModel::OnCopyCommand(Object^ parameter)

View File

@ -66,16 +66,6 @@ namespace CalculatorApp
}
}
property Windows::UI::Xaml::Visibility AppBarVisibility
{
Windows::UI::Xaml::Visibility get()
{
return CalculatorApp::Common::NavCategory::IsCalculatorViewMode(Mode)
? Windows::UI::Xaml::Visibility::Visible
: Windows::UI::Xaml::Visibility::Collapsed;
}
}
private:
bool TryRecoverFromNavigationModeFailure();

View File

@ -86,7 +86,6 @@ namespace CalculatorApp
COMMAND_FOR_METHOD(PasteCommand, StandardCalculatorViewModel::OnPasteCommand);
COMMAND_FOR_METHOD(ButtonPressed, StandardCalculatorViewModel::OnButtonPressed);
COMMAND_FOR_METHOD(ClearMemoryCommand, StandardCalculatorViewModel::OnClearMemoryCommand);
COMMAND_FOR_METHOD(PinUnpinAppBarButtonOnClicked, StandardCalculatorViewModel::OnPinUnpinCommand);
COMMAND_FOR_METHOD(MemoryItemPressed, StandardCalculatorViewModel::OnMemoryItemPressed);
COMMAND_FOR_METHOD(MemoryAdd, StandardCalculatorViewModel::OnMemoryAdd);
COMMAND_FOR_METHOD(MemorySubtract, StandardCalculatorViewModel::OnMemorySubtract);

View File

@ -234,12 +234,9 @@
<ClInclude Include="Controls\OverflowTextBlockAutomationPeer.h" />
<ClInclude Include="Common\AlwaysSelectedCollectionView.h" />
<ClInclude Include="Common\BindableBase.h" />
<ClInclude Include="Controls\AppBar.h" />
<ClInclude Include="Controls\CalculationResult.h" />
<ClInclude Include="Controls\CalculatorButton.h" />
<ClInclude Include="Controls\FlipButtons.h" />
<ClInclude Include="Controls\OperandTextBox.h" />
<ClInclude Include="Controls\OperatorTextBox.h" />
<ClInclude Include="Controls\OverflowTextBlock.h" />
<ClInclude Include="Controls\RadixButton.h" />
<ClInclude Include="Controls\SupplementaryItemsControl.h" />
@ -372,8 +369,6 @@
<ClCompile Include="Controls\CalculationResult.cpp" />
<ClCompile Include="Controls\CalculatorButton.cpp" />
<ClCompile Include="Controls\FlipButtons.cpp" />
<ClCompile Include="Controls\OperandTextBox.cpp" />
<ClCompile Include="Controls\OperatorTextBox.cpp" />
<ClCompile Include="Controls\OverflowTextBlock.cpp" />
<ClCompile Include="Controls\RadixButton.cpp" />
<ClCompile Include="Controls\SupplementaryItemsControl.cpp" />

View File

@ -271,12 +271,6 @@
<ClCompile Include="Views\NumberPad.xaml.cpp" />
<ClCompile Include="Views\SupplementaryResults.xaml.cpp" />
<ClCompile Include="Views\UnitConverter.xaml.cpp" />
<ClCompile Include="Controls\OperandTextBox.cpp">
<Filter>Controls</Filter>
</ClCompile>
<ClCompile Include="Controls\OperatorTextBox.cpp">
<Filter>Controls</Filter>
</ClCompile>
<ClCompile Include="Controls\FlipButtons.cpp">
<Filter>Controls</Filter>
</ClCompile>
@ -321,9 +315,6 @@
<ClInclude Include="Common\BindableBase.h">
<Filter>Common</Filter>
</ClInclude>
<ClInclude Include="Controls\AppBar.h">
<Filter>Controls</Filter>
</ClInclude>
<ClInclude Include="Controls\CalculationResult.h">
<Filter>Controls</Filter>
</ClInclude>
@ -370,12 +361,6 @@
<ClInclude Include="Views\NumberPad.xaml.h" />
<ClInclude Include="Views\SupplementaryResults.xaml.h" />
<ClInclude Include="Views\UnitConverter.xaml.h" />
<ClInclude Include="Controls\OperandTextBox.h">
<Filter>Controls</Filter>
</ClInclude>
<ClInclude Include="Controls\OperatorTextBox.h">
<Filter>Controls</Filter>
</ClInclude>
<ClInclude Include="Controls\FlipButtons.h">
<Filter>Controls</Filter>
</ClInclude>

View File

@ -1,29 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include "Common/KeyboardShortcutManager.h"
namespace CalculatorApp
{
namespace Controls
{
public ref class AppBar sealed : public Windows::UI::Xaml::Controls::AppBar
{
public:
AppBar()
{}
protected:
virtual void OnKeyDown(Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e) override
{
Windows::UI::Xaml::Controls::AppBar::OnKeyDown(e);
if (e->Key == Windows::System::VirtualKey::Escape)
{
Common::KeyboardShortcutManager::IgnoreEscape(true);
}
}
};
}
}

View File

@ -1,58 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "pch.h"
#include "OperandTextBox.h"
#include "regex"
using namespace CalculatorApp;
using namespace CalculatorApp::Controls;
using namespace Platform;
using namespace std;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::Devices::Input;
using namespace Windows::System;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
void OperandTextBox::OnApplyTemplate()
{
this->IsEnabled = false;
this->IsHitTestVisible = false;
this->IsTapEnabled = false;
this->MaxLength = 50;
this->IsRightTapEnabled = false;
this->IsTabStop = false;
auto parent = VisualTreeHelper::GetParent(this);
ListViewItem^ listViewItem;
ListView^ listView;
while (parent != nullptr)
{
if (listViewItem == nullptr)
{
listViewItem = dynamic_cast<ListViewItem^>(parent);
}
listView = dynamic_cast<ListView^>(parent);
if (listView != nullptr)
{
break;
}
parent = VisualTreeHelper::GetParent(parent);
}
if (listView != nullptr)
{
listViewItem->IsEnabled = false;
listViewItem->IsHitTestVisible = false;
listViewItem->IsTapEnabled = false;
}
TextBox::OnApplyTemplate();
}

View File

@ -1,19 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
namespace CalculatorApp
{
namespace Controls
{
public ref class OperandTextBox sealed : public Windows::UI::Xaml::Controls::TextBox
{
public:
OperandTextBox() { }
protected:
virtual void OnApplyTemplate() override;
};
}
}

View File

@ -1,59 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "pch.h"
#include "OperatorTextBox.h"
#include "regex"
using namespace CalculatorApp;
using namespace CalculatorApp::Controls;
using namespace Platform;
using namespace std;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::Devices::Input;
using namespace Windows::System;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
void OperatorTextBox::OnApplyTemplate()
{
this->IsEnabled = false;
this->IsHitTestVisible = false;
this->IsTapEnabled = false;
this->MaxLength = 50;
this->IsReadOnly = true;
this->IsRightTapEnabled = false;
this->IsTabStop = false;
auto parent = VisualTreeHelper::GetParent(this);
ListViewItem^ listViewItem;
ListView^ listView;
while (parent != nullptr)
{
if (listViewItem == nullptr)
{
listViewItem = dynamic_cast<ListViewItem^>(parent);
}
listView = dynamic_cast<ListView^>(parent);
if (listView != nullptr)
{
break;
}
parent = VisualTreeHelper::GetParent(parent);
}
if (listView != nullptr)
{
listViewItem->IsEnabled = false;
listViewItem->IsHitTestVisible = false;
listViewItem->IsTapEnabled = false;
}
TextBox::OnApplyTemplate();
}

View File

@ -1,19 +0,0 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
namespace CalculatorApp
{
namespace Controls
{
public ref class OperatorTextBox sealed : public Windows::UI::Xaml::Controls::TextBox
{
public:
OperatorTextBox() { }
protected:
virtual void OnApplyTemplate() override;
};
}
}

View File

@ -37,105 +37,6 @@
<!-- TextBox Styles -->
<Style x:Key="OperandTextBoxStyle" TargetType="controls:OperandTextBox">
<Setter Property="MinWidth" Value="32"/>
<Setter Property="MinHeight" Value="20"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="SelectionHighlightColor" Value="{ThemeResource SystemControlBackgroundAccentBrush}"/>
<Setter Property="FontSize" Value="{ThemeResource BodyFontSize}"/>
<Setter Property="IsTextScaleFactorEnabled" Value="False"/>
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="Padding" Value="2,0,3,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:OperandTextBox">
<Grid x:Name="BackgroundElement" Background="{ThemeResource SystemControlBackgroundAltHighBrush}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled"/>
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Target="ContentElement.Foreground" Value="{ThemeResource SystemControlForegroundAccentBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="BackgroundElement.Background" Value="{ThemeResource SystemControlHighlightListAccentLowBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Focused">
<VisualState.Setters>
<Setter Target="BackgroundElement.Background" Value="{ThemeResource SystemControlForegroundChromeWhiteBrush}"/>
<Setter Target="ContentElement.Foreground" Value="{ThemeResource SystemControlBackgroundChromeBlackHighBrush}"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ScrollViewer x:Name="ContentElement"
Padding="{TemplateBinding Padding}"
VerticalAlignment="Center"
AutomationProperties.AccessibilityView="Raw"
HorizontalScrollBarVisibility="Hidden"
HorizontalScrollMode="Disabled"
IsDeferredScrollingEnabled="False"
IsHorizontalRailEnabled="True"
IsTabStop="False"
IsVerticalRailEnabled="False"
VerticalScrollBarVisibility="Disabled"
VerticalScrollMode="Disabled"
ZoomMode="Disabled"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="OperatorTextBoxStyle" TargetType="controls:OperatorTextBox">
<Setter Property="MinWidth" Value="4"/>
<Setter Property="MinHeight" Value="20"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:OperatorTextBox">
<Grid x:Name="BackgroundElement" Background="{ThemeResource SystemControlBackgroundAltHighBrush}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled"/>
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Target="textElement.Foreground" Value="{ThemeResource SystemControlPageTextBaseMediumBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="BackgroundElement.Background" Value="{ThemeResource SystemControlHighlightListAccentLowBrush}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Focused">
<VisualState.Setters>
<Setter Target="BackgroundElement.Background" Value="{ThemeResource SystemControlBackgroundAccentBrush}"/>
<Setter Target="textElement.Foreground" Value="{ThemeResource SystemControlForegroundChromeWhiteBrush}"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<TextBlock x:Name="textElement"
Margin="0,-2,0,2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{TemplateBinding Foreground}"
FontSize="16"
IsHitTestVisible="True"
IsTextScaleFactorEnabled="False"
Text="{Binding Token}"
TextAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="controls:OverflowTextBlock">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="Template">

View File

@ -275,13 +275,6 @@ void MainPage::OnPageUnLoaded(_In_ Object^, _In_ RoutedEventArgs^)
// On closing the instance of a window, On Window Consolidate gets fired.
}
void MainPage::PinUnpinAppBarButtonOnClicked(
_In_ Object^ sender,
_In_ RoutedEventArgs^ e)
{
m_model->CalculatorViewModel->OnPinUnpinCommand(sender);
}
void MainPage::SetDefaultFocus()
{
if (m_calculator != nullptr && m_calculator->Visibility == ::Visibility::Visible)

View File

@ -70,8 +70,6 @@ namespace CalculatorApp
void OnPageLoaded(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
void OnPageUnLoaded(_In_ Platform::Object^, _In_ Windows::UI::Xaml::RoutedEventArgs^);
void PinUnpinAppBarButtonOnClicked(_In_ Platform::Object^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs^ e);
void EnsureCalculator();
void EnsureConverter();
void EnsureDateCalculator();

View File

@ -10,8 +10,6 @@
#include "Views/SupplementaryResults.g.h"
#include "Controls/SupplementaryItemsControl.h"
#include "Controls/OperandTextBox.h"
#include "Controls/OperatorTextBox.h"
#include "Controls/HorizontalNoOverflowStackPanel.h"
#include "CalcViewModel/UnitConverterViewModel.h"