예제 #1
0
        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();
                }
            }
        }
예제 #2
0
        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();
                    }
                }
            }
        }
예제 #3
0
        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();
                }
            }
        }
예제 #4
0
파일: PluginRemover.cs 프로젝트: Muny/DWARF
        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();
                }
            }
        }