public ApplicationUpdater(int ID, Action OnCancelled) { if (!ApplicationManager.instance.InstalledApplications.ContainsKey(ID)) { OnCancelled(); } else { _appinfo = DynamicJson.Parse(wc.DownloadString(Consts.URLs.APP_INFO(ID))); var asi = new AskAction("Update", "Application", (string)_appinfo.name, "Now, this application's plugins can:", ApplicationManager.instance.GetApplicationPermissions(ID)); asi.Visibility = System.Windows.Visibility.Visible; if (asi.ShowDialog().Value) { this.ID = ID; wc.DownloadProgressChanged += wc_DownloadProgressChanged; wc.DownloadFileCompleted += wc_DownloadFileCompleted; wc.DownloadFileAsync(new Uri(Consts.URLs.APP_DOWNLOAD(ID)), Consts.AppData + "\\Temp\\" + ID + ".zip"); } else { OnCancelled(); } } }
public PluginInstaller(int ID, Action OnCancelled, bool force) { this.ID = ID; if (ApplicationManager.instance.InstalledPlugins.ContainsKey(ID) && !force) { OnCancelled(); } else { _plugininfo = DynamicJson.Parse(wc.DownloadString(Consts.URLs.PLUGIN_INFO(ID))); if (force) { work(); } else { var asi = new AskAction("Install", "Plugin", _plugininfo.name, "This plugin can:", ApplicationManager.instance.GetPluginPermissions(ID)); asi.Visibility = System.Windows.Visibility.Visible; if (asi.ShowDialog().Value) { work(); } else { OnCancelled(); } } } }
public ApplicationRemover(int ID, Action OnRemoved, Action OnCancelled) { this.ID = ID; if (!ApplicationManager.instance.InstalledApplications.ContainsKey(ID)) { OnCancelled(); } else { var asi = new AskAction("Remove", "Application", ApplicationManager.instance.InstalledApplications[ID].Name, "", "Removing this application will also delete any data stored by this application (in the 'data' folder)."); asi.Visibility = System.Windows.Visibility.Visible; if (asi.ShowDialog().Value) { ApplicationManager.instance.RemoveAppShortcut(ApplicationManager.instance.InstalledApplications[ID].Name); Directory.Delete(Consts.AppData + "\\Applications\\" + ApplicationManager.instance.InstalledApplications[ID].Name, true); OnRemoved(); } else { OnCancelled(); } } }
public PluginRemover(int ID, Action OnRemoved, Action OnCancelled) { this.ID = ID; if (!ApplicationManager.instance.InstalledPlugins.ContainsKey(ID)) { OnCancelled(); } else { WebClient wc = new WebClient(); dynamic _plugininfo = DynamicJson.Parse(wc.DownloadString(Consts.URLs.PLUGIN_INFO(ID))); var asi = new AskAction("Remove", "Plugin", _plugininfo.name, "", "Removing this plugin will cause all applications that utilize it to stop working."); asi.Visibility = System.Windows.Visibility.Visible; if (asi.ShowDialog().Value) { Directory.Delete(Consts.AppData + "\\Plugins\\" + (string)_plugininfo.name, true); OnRemoved(); } else { OnCancelled(); } } }