private void AddNewItemButton_Click(object sender, RoutedEventArgs e) { GI.MakeNewItemPanel(this, "Name", "", "", Brushes.White, Brushes.White, false); }
public static void LoadSettings(List <GI.GraphColunm> GraphData, MainWindow SenderWindow, int DataCacheSize, int GraphModeCount) { try { FI SaveConfigs = new FI(); SaveConfigs.LoadFromFile("cfg.txt"); FI.CategoryData CurrentCategory = new FI.CategoryData("MainWindow Data", 0); Application.Current.MainWindow.Left = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, new FI.ItemData("Location X", 0)); Application.Current.MainWindow.Top = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, new FI.ItemData("Location Y", 0)); SenderWindow.TimeFrameCombobox.SelectedIndex = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, new FI.ItemData("TimeFrame Index", 0)); SenderWindow.TimeElementsCombobox.SelectedIndex = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, new FI.ItemData("Time Elements Index", 0)); SenderWindow.CurrentGraphMode = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, new FI.ItemData("Current Mode", 0)); SenderWindow.CurrentThemeIndex = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, new FI.ItemData("Theme Index", 0)); CurrentCategory = new FI.CategoryData("Item", 0); while (SaveConfigs.IsAnyMoreOfCat(CurrentCategory)) { GI.MakeNewItemPanel( SenderWindow, SaveConfigs.FindtItemInItemstack_STR(CurrentCategory, new FI.ItemData("Name", 0)), SaveConfigs.FindtItemInItemstack_STR(CurrentCategory, new FI.ItemData("URL", 0)), SaveConfigs.FindtItemInItemstack_STR(CurrentCategory, new FI.ItemData("XPath", 0)), (SolidColorBrush)SaveConfigs.FindtItemInItemstack_BRS(CurrentCategory, new FI.ItemData("BorderColor", 0)), (SolidColorBrush)SaveConfigs.FindtItemInItemstack_BRS(CurrentCategory, new FI.ItemData("FillColor", 0)), true ); CurrentCategory.Offset++; } CurrentCategory = new FI.CategoryData("HistoricData", 0); while (SaveConfigs.IsAnyMoreOfCat(CurrentCategory)) { GI.GraphColunm NewData = new GI.GraphColunm(); NewData.TimeTable = SaveConfigs.FindtItemInItemstack_DAT(CurrentCategory, new FI.ItemData("Timestamp", 0)); NewData.GraphElements = new List <GI.GraphElement>(); FI.ItemData MomentItem = new FI.ItemData("Name", 0); while (SaveConfigs.IsAnyMoreWithinCat(CurrentCategory, MomentItem)) { GI.GraphElement NewElement = new GI.GraphElement(); NewElement.Name = SaveConfigs.FindtItemInItemstack_STR(CurrentCategory, MomentItem); double[] MomentValues = new double[2]; MomentValues[0] = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, new FI.ItemData("Value1", MomentItem.Offset)); MomentValues[1] = SaveConfigs.FindtItemInItemstack_INT(CurrentCategory, new FI.ItemData("Value2", MomentItem.Offset)); NewElement.Value = MomentValues; NewElement.BorderColor = (SolidColorBrush)SaveConfigs.FindtItemInItemstack_BRS(CurrentCategory, new FI.ItemData("BorderColor", MomentItem.Offset)); NewElement.FillColor = (SolidColorBrush)SaveConfigs.FindtItemInItemstack_BRS(CurrentCategory, new FI.ItemData("FillColor", MomentItem.Offset)); NewData.GraphElements.Add(NewElement); MomentItem.Offset++; } GraphData[CurrentCategory.Offset] = NewData; CurrentCategory.Offset++; } } catch { MessageBox.Show("Could not load cfg"); Application.Current.Shutdown(); } }