private async void ColorPickerCancel_Click(object sender, RoutedEventArgs e) { await GI.FadeOut(this); SelectedColor = null; SelectionMade = true; }
private async void ListSelectionButton_Click(object sender, RoutedEventArgs e) { await GI.FadeOut(this); SelectedIndex = (int)(sender as Button).Tag; SelectionMade = true; }
private async void ColorClick_Click(object sender, RoutedEventArgs e) { await GI.FadeOut(this); SelectedColor = (sender as Button).Background; SelectionMade = true; }
private async void WarningYesButton_Click(object sender, RoutedEventArgs e) { await GI.FadeOut(this); if (RetractAgain) { await GI.ExpandWindow(SenderWindow, false); } YesBool = true; SelectionMade = true; }
private async void ExitButton_Click(object sender, RoutedEventArgs e) { await GI.FadeOut(this); ExitSave = true; RefreshModeChange = true; while (!SaveComplete) { await Task.Delay(100); } Application.Current.Shutdown(); }
private async void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { RefreshModeChange = true; e.Cancel = true; await GI.FadeOut(this); while (!SaveComplete) { await Task.Delay(100); } Application.Current.Shutdown(); }
private async void ListSelectionCancelButton_Click(object sender, RoutedEventArgs e) { await GI.FadeOut(this); SelectionMade = true; }
async Task RunMainLoop(List <GI.GraphColunm> GraphData) { while (true) { if (ExitSave) { if (!SaveComplete) { SaveAndLoadClass.SaveSettings(GraphData, this, DataCacheSize, CurrentGraphMode, CurrentThemeIndex); } SaveComplete = true; while (true) { await Task.Delay(100); } } if (ClearGraphData) { GraphData.Clear(); ClearGraphData = false; for (int i = 0; i < DataCacheSize; i++) { GraphData.Add(new GI.GraphColunm(DateTime.Now, new List <GI.GraphElement>())); } } if (FlatlineGraphData) { FlatlineGraphData = false; for (int i = 1; i < DataCacheSize; i++) { GraphData[i] = new GI.GraphColunm(GraphData[0].TimeTable, GraphData[0].GraphElements); } } GraphLoadingControl NewLoading = new GraphLoadingControl(GraphCanvas, GraphCanvas.ActualWidth, GraphCanvas.ActualHeight); GraphCanvas.Children.Add(NewLoading); GraphLoadingControl NewLoading2 = null; if (GMCValues.IsPieChartEnabled) { NewLoading2 = new GraphLoadingControl(PieGraphCanvas, PieGraphCanvas.ActualWidth, PieGraphCanvas.ActualHeight); PieGraphCanvas.Children.Add(NewLoading2); } if (ItemStack.Children.Count > 0) { for (int i = 0; i < ItemStack.Children.Count; i++) { ItemDesign SenderDesign = ItemStack.Children[i] as ItemDesign; SenderDesign.ResetWarningLabels(); } GI.GraphColunm NewDataSet = new GI.GraphColunm(DateTime.Now, new List <GI.GraphElement>()); try { if (IsTimeOver(DateTime.Now, GraphData[0].TimeTable, TimeFrameCombobox.SelectedIndex) || ManualRefresh) { for (int i = 0; i < ItemStack.Children.Count; i++) { if (ExitSave) { break; } ItemDesign SenderDesign = ItemStack.Children[i] as ItemDesign; SenderDesign.URLErrorLabel.Foreground = (Brush)Application.Current.FindResource("StandartItemDesignBadColor"); SenderDesign.XPathErrorLabel.Foreground = (Brush)Application.Current.FindResource("StandartItemDesignBadColor"); if (SenderDesign.ItemURLTextBox.Text != "" && SenderDesign.ItemXPathTextBox.Text != "") { HtmlWeb web = new HtmlWeb(); HtmlDocument doc = await web.LoadFromWebAsync(SenderDesign.ItemURLTextBox.Text); SenderDesign.URLErrorLabel.Visibility = Visibility.Hidden; HtmlNode node = doc.DocumentNode.SelectSingleNode(SenderDesign.ItemXPathTextBox.Text.Replace("/tbody", "")); if (node == null) { break; } SenderDesign.XPathErrorLabel.Visibility = Visibility.Hidden; double[] NewData = new double[GraphModes.Count]; for (int j = 0; j < GraphModes.Count; j++) { NewData[j] = RunCommandList(j, GraphModes[j].ValueProcessingList, node, GraphData, i); } NewDataSet.GraphElements.Add(new GI.GraphElement(NewData, SenderDesign.ItemNameTextBox.Text, (SolidColorBrush)SenderDesign.ItemFillColorButton.Background, (SolidColorBrush)SenderDesign.ItemBorderColorButton.Background)); doc = null; GC.Collect(); } } } if (!ExitSave) { if (IsTimeOver(DateTime.Now, GraphData[0].TimeTable, TimeFrameCombobox.SelectedIndex) || ManualRefresh) { for (int i = GraphData.Count - 1; i > 0; i--) { GraphData[i] = GraphData[i - 1]; } GraphData[0] = NewDataSet; } if (EqualizeColorsData) { EqualizeColorsData = false; for (int i = 1; i < DataCacheSize; i++) { for (int j = 0; j < ItemStack.Children.Count; j++) { int TargetJ = j; while (GraphData[i].GraphElements[TargetJ].Name != GraphData[0].GraphElements[j].Name) { TargetJ++; if (TargetJ > ItemStack.Children.Count - 1) { TargetJ = 0; } if (TargetJ == j) { break; } } GraphData[i].GraphElements[TargetJ] = new GI.GraphElement(GraphData[i].GraphElements[TargetJ].Value, GraphData[i].GraphElements[TargetJ].Name, GraphData[0].GraphElements[j].FillColor, GraphData[0].GraphElements[j].BorderColor); } } } UpdateVisualData(GraphData); } SaveAndLoadClass.SaveSettings(GraphData, this, DataCacheSize, CurrentGraphMode, CurrentThemeIndex); SettingsSavedLabel.Visibility = Visibility.Visible; await GI.FadeIn(SettingsSavedLabel); await Task.Delay(1000); await GI.FadeOut(SettingsSavedLabel); SettingsSavedLabel.Visibility = Visibility.Hidden; } catch { ErrorInLoading = true; } } NewLoading.DoRemove(); if (GMCValues.IsPieChartEnabled) { NewLoading2.DoRemove(); } ManualRefresh = false; if (ErrorInLoading) { await Task.Delay(10000); ErrorInLoading = false; } else { await WaitUntil(TimeFrameCombobox.SelectedIndex, GraphData); } } }