Exemple #1
0
        private void RefreshContents(bool plugins, bool sideloader)
        {
            if (plugins)
            {
                PluginLoader.StartReload();
            }
            if (sideloader)
            {
                SideloaderModLoader.StartReload();
            }

            foreach (var window in GetWindows <DockContent>())
            {
                if (window is PluginsWindow pw)
                {
                    if (plugins)
                    {
                        pw.RefreshList();
                    }
                }
                else if (window is SideloaderModsWindow sm)
                {
                    if (sideloader)
                    {
                        sm.RefreshList();
                    }
                }
            }
        }
Exemple #2
0
        private async Task ShowModUpdateDialog()
        {
            try
            {
                try
                {
                    Enabled = false;

                    _checkForUpdatesCancel?.Cancel();

                    PluginLoader.CancelReload();
                    SideloaderModLoader.CancelReload();

                    await PluginLoader.Plugins.LastOrDefaultAsync().Timeout(TimeSpan.FromSeconds(30));

                    await SideloaderModLoader.Zipmods.LastOrDefaultAsync().Timeout(TimeSpan.FromSeconds(30));

                    var updateSources = GetUpdateSources();
                    if (!updateSources.Any())
                    {
                        throw new IOException("No update sources are available");
                    }
                    ModUpdateProgressDialog.StartUpdateDialog(this, updateSources);
                }
                catch (Exception ex)
                {
                    var errorMsg = "Failed to start update - " + ex.ToStringDemystified();
                    Console.WriteLine(errorMsg);
                    MessageBox.Show(errorMsg, "Update failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                SideloaderModLoader.StartReload();
                PluginLoader.StartReload();

                var contentWindows = GetWindows <DockContent>().OfType <IContentWindow>().ToList();
                foreach (var window in contentWindows)
                {
                    window.RefreshList();
                }

                updateSideloaderModpackToolStripMenuItem.BackColor = DefaultBackColor;
                updateSideloaderModpackToolStripMenuItem.ForeColor = DefaultForeColor;
            }
            finally
            {
                Enabled = true;
            }
        }
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     SideloaderModLoader.StartReload();
     RefreshList();
 }