Dark Theme For Graph Control (#1106)

* Added dark them to graph control, started dark theme for the controls on the graph

* Dark theme for graphing mode updated to use event model, diagnostics added, cleaned up code that wasn't needed

* Updated prepare-release-internalonly.yaml internal package version

* Updated Theme Settings properties, removed version change, other small changes from PR feedback>

* Updated the localSettings check and updated the GraphTheme event to send bool instead of string

* Updated the equation line color to change with the graph theme

* Rebased onto master and issues created during the rebase

* Updates per code review feedback

* Update settings properties to just have IsMatchAppTheme property and updated the high contrast settings for the graph control

* Match version to current in master

* Updated per PR feedback

* Fix resetting the m_lastLineColorIndex to only happen when reassignColors is true

* Changed second if to else if in the OnPropertyChanged method

* fixed control button and equation line colors
This commit is contained in:
Stephanie Anderl 2020-03-27 17:20:35 -07:00 committed by GitHub
parent 780e53780d
commit cf735bbcf5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 389 additions and 89 deletions

View file

@ -41,6 +41,7 @@ namespace CalculatorApp
constexpr auto EVENT_NAME_VARIABLE_CHANGED = L"VariableChanged";
constexpr auto EVENT_NAME_VARIABLE_SETTING_CHANGED = L"VariableSettingChanged";
constexpr auto EVENT_NAME_GRAPH_SETTINGS_CHANGED = L"GraphSettingsChanged";
constexpr auto EVENT_NAME_GRAPH_THEME = L"GraphTheme";
constexpr auto EVENT_NAME_EXCEPTION = L"Exception";
@ -303,12 +304,22 @@ namespace CalculatorApp
TraceLoggingCommon::GetInstance()->LogLevel2Event(StringReference(EVENT_NAME_VARIABLE_SETTING_CHANGED), fields);
}
void TraceLogger::LogGraphSettingsChanged(GraphSettingsType settingType)
void TraceLogger::LogGraphSettingsChanged(GraphSettingsType settingType, String ^ settingValue)
{
auto fields = ref new LoggingFields();
fields->AddString(StringReference(CALC_MODE), StringReference(GRAPHING_MODE));
fields->AddInt16(L"SettingType", static_cast<int16>(settingType));
fields->AddString(L"SettingValue", settingValue);
TraceLoggingCommon::GetInstance()->LogLevel2Event(StringReference(EVENT_NAME_GRAPH_SETTINGS_CHANGED), fields);
}
void TraceLogger::LogGraphTheme(String ^ graphTheme)
{
auto fields = ref new LoggingFields();
fields->AddString(StringReference(CALC_MODE), StringReference(GRAPHING_MODE));
fields->AddString(L"GraphTheme", graphTheme);
TraceLoggingCommon::GetInstance()->LogLevel2Event(StringReference(EVENT_NAME_GRAPH_THEME), fields);
}
}

View file

@ -27,7 +27,8 @@ namespace CalculatorApp
public enum class GraphSettingsType
{
Grid,
TrigUnits
TrigUnits,
Theme
};
public enum class GraphButton
@ -73,7 +74,8 @@ namespace CalculatorApp
void LogGraphLineStyleChanged(LineStyleType style);
void LogVariableChanged(Platform::String ^ inputChangedType, Platform::String ^ variableName);
void LogVariableSettingsChanged(Platform::String ^ setting);
void LogGraphSettingsChanged(GraphSettingsType settingsType);
void LogGraphSettingsChanged(GraphSettingsType settingsType, Platform::String ^ settingValue);
void LogGraphTheme(Platform::String ^ graphTheme);
internal:
void LogStandardException(CalculatorApp::Common::ViewMode mode, std::wstring_view functionName, _In_ const std::exception& e);
void LogPlatformException(CalculatorApp::Common::ViewMode mode, std::wstring_view functionName, _In_ Platform::Exception ^ e);

View file

@ -33,7 +33,7 @@ namespace CalculatorApp::ViewModel
{
}
EquationViewModel::EquationViewModel(Equation ^ equation, int functionLabelIndex, Windows::UI::Color color)
EquationViewModel::EquationViewModel(Equation ^ equation, int functionLabelIndex, Windows::UI::Color color, int colorIndex)
: m_AnalysisErrorVisible{ false }
, m_FunctionLabelIndex{ functionLabelIndex }
, m_KeyGraphFeaturesItems{ ref new Vector<KeyGraphFeaturesItem ^>() }
@ -46,6 +46,7 @@ namespace CalculatorApp::ViewModel
GraphEquation = equation;
LineColor = color;
LineColorIndex = colorIndex;
IsLineEnabled = true;
}

View file

@ -41,12 +41,13 @@ public
ref class EquationViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
{
public:
EquationViewModel(GraphControl::Equation ^ equation, int functionLabelIndex, Windows::UI::Color color);
EquationViewModel(GraphControl::Equation ^ equation, int functionLabelIndex, Windows::UI::Color color, int colorIndex);
OBSERVABLE_OBJECT();
OBSERVABLE_PROPERTY_R(GraphControl::Equation ^, GraphEquation);
OBSERVABLE_PROPERTY_RW(int, FunctionLabelIndex);
OBSERVABLE_PROPERTY_RW(bool, IsLastItemInList);
PROPERTY_RW(int, LineColorIndex);
property Platform::String ^ Expression
{

View file

@ -10,6 +10,7 @@ using namespace CalcManager::NumberFormattingUtils;
using namespace GraphControl;
using namespace std;
using namespace Platform;
using namespace Windows::UI::Xaml;
GraphingSettingsViewModel::GraphingSettingsViewModel()
: m_XMinValue(0)
@ -36,6 +37,7 @@ void GraphingSettingsViewModel::SetGrapher(Grapher ^ grapher)
}
}
Graph = grapher;
InitRanges();
RaisePropertyChanged(L"TrigUnit");
}
@ -100,7 +102,7 @@ void GraphingSettingsViewModel::UpdateDisplayRange()
m_Graph->SetDisplayRanges(m_XMinValue, m_XMaxValue, m_YMinValue, m_YMaxValue);
TraceLogger::GetInstance()->LogGraphSettingsChanged(GraphSettingsType::Grid);
TraceLogger::GetInstance()->LogGraphSettingsChanged(GraphSettingsType::Grid, L"");
}
bool GraphingSettingsViewModel::HasError()

View file

@ -232,7 +232,7 @@ namespace CalculatorApp::ViewModel
RaisePropertyChanged(L"TrigModeDegrees");
RaisePropertyChanged(L"TrigModeGradians");
TraceLogger::GetInstance()->LogGraphSettingsChanged(GraphSettingsType::TrigUnits);
TraceLogger::GetInstance()->LogGraphSettingsChanged(GraphSettingsType::TrigUnits, L"Radians");
}
}
}
@ -253,7 +253,7 @@ namespace CalculatorApp::ViewModel
RaisePropertyChanged(L"TrigModeRadians");
RaisePropertyChanged(L"TrigModeGradians");
TraceLogger::GetInstance()->LogGraphSettingsChanged(GraphSettingsType::TrigUnits);
TraceLogger::GetInstance()->LogGraphSettingsChanged(GraphSettingsType::TrigUnits, L"Degrees");
}
}
}
@ -274,7 +274,7 @@ namespace CalculatorApp::ViewModel
RaisePropertyChanged(L"TrigModeDegrees");
RaisePropertyChanged(L"TrigModeRadians");
TraceLogger::GetInstance()->LogGraphSettingsChanged(GraphSettingsType::TrigUnits);
TraceLogger::GetInstance()->LogGraphSettingsChanged(GraphSettingsType::TrigUnits, L"Gradians");
}
}
}