private Task LaunchVersionCheck() { return(new Task(() => { if (Options.DoNotCheckForUpdates == true) { return; } blackScreen.SetWorkingMessage("Checking for XrmToolBox update..."); var currentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); var cvc = new GithubVersionChecker(currentVersion, "MsCrmTools", "XrmToolBox"); cvc.Run(); if (!string.IsNullOrEmpty(cvc.Cpi?.Version)) { if (currentOptions.LastUpdateCheck.Date != DateTime.Now.Date) { Invoke(new Action(() => { var nvForm = new NewVersionForm(currentVersion, cvc.Cpi.Version, cvc.Cpi.Description, "MsCrmTools", "XrmToolBox", new Uri(cvc.Cpi.PackageUrl)); var result = nvForm.ShowDialog(this); if (result == DialogResult.OK) { Close(); } })); } } currentOptions.LastUpdateCheck = DateTime.Now; currentOptions.Save(); })); }
public MainForm(string[] args) { pluginsModels = new List <PluginModel>(); pluginControlStatuses = new List <PluginControlStatus>(); // Set drawing optimizations SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); // Displaying Welcome screen var version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); blackScreen = new WelcomeDialog(version) { StartPosition = FormStartPosition.CenterScreen }; blackScreen.Show(this); blackScreen.SetWorkingMessage("Loading..."); // Loading XrmToolBox options string errorMessage; if (!Options.Load(out currentOptions, out errorMessage)) { MessageBox.Show(this, "An error ocurred when loading XrmToolBox options. A new options file has been created.\n\n" + errorMessage); } if (currentOptions.RememberSession) { if (!string.IsNullOrEmpty(currentOptions.LastConnection)) { initialConnectionName = currentOptions.LastConnection; } if (!string.IsNullOrEmpty(currentOptions.LastPlugin)) { initialPluginName = currentOptions.LastPlugin; } } // Read arguments to detect if a plugin should be displayed automatically if (args.Length > 0) { initialConnectionName = ExtractSwitchValue("/connection:", ref args); initialPluginName = ExtractSwitchValue("/plugin:", ref args); } InitializeComponent(); ProcessMenuItemsForPlugin(); MouseWheel += (sender, e) => pnlPlugins.Focus(); Text = string.Format("{0} (v{1})", Text, Assembly.GetExecutingAssembly().GetName().Version); // Loading connection controls blackScreen.SetWorkingMessage("Loading connection controls..."); ManageConnectionControl(); ccsb.MergeConnectionsFiles = currentOptions.MergeConnectionFiles; }