public MainWindow() { InitializeComponent(); CenterWindowOnScreen(); ChannelComboBox.ItemsSource = new List <string>() { "alpha", "beta", "store" }; config = new Config <BuildData>(); config.OnConfigDataChanged += RefreshUI; config.OnConfigDataChanged += CheckForRequiredFiles; BuildData d = config.Load(configFilePath); if (d == null) { config.Save(new BuildData("appID", "key", "", "", new AppVersion(), "alpha"), configFilePath); } }
private void RefreshUI(BuildData buildData) { if (buildData == null) { return; } AppIDTextBox.Text = buildData.AppID; KeyTextBox.Text = buildData.SecretKey; DirectoryTextBox.Text = buildData.DirectoryName; ExecutableTextBox.Text = buildData.ExecutableName; VersionTextBox.Text = buildData.AppVersion.ToString(); if (!ChannelComboBox.Items.Contains(buildData.BuildChannel)) { ChannelComboBox.Items.Add(buildData.BuildChannel); ChannelComboBox.SelectedItem = buildData.BuildChannel; } else { ChannelComboBox.SelectedItem = buildData.BuildChannel; } }
private void CheckForRequiredFiles(BuildData data) { if (!System.IO.File.Exists("ovr-platform-util.exe")) { MessageBox.Show("ovr-platform-util.exe not found!", "Error"); canDoUpload = false; return; } if (!File.Exists(data.DirectoryName + "/" + data.ExecutableName)) { MessageBox.Show(data.DirectoryName + " / " + data.ExecutableName + " not found!", "Error"); canDoUpload = false; return; } if (!Directory.Exists(data.DirectoryName)) { MessageBox.Show(data.DirectoryName + " not found!", "Error"); canDoUpload = false; return; } canDoUpload = true; }
private void SaveConfigButton_Click(object sender, RoutedEventArgs e) { BuildData buildData = new BuildData(AppIDTextBox.Text, KeyTextBox.Text, DirectoryTextBox.Text, ExecutableTextBox.Text, new AppVersion(VersionTextBox.Text), ChannelComboBox.SelectedItem.ToString()); config.Save(buildData, configFilePath); }