Пример #1
0
 static void FinalizeApp()
 {
     UICache.Save();
     UsageStats.OnFinish();
     Favorites.OnFinish();
     Logging.Info("Ending DatAdmin GUI");
     Logging.QuitLogging();
     Core.FinalizeApp();
     if (Core.ExecuteAfterFinalize != null)
     {
         System.Diagnostics.Process.Start(Core.ExecuteAfterFinalize);
     }
 }
Пример #2
0
        private void MoveCommand(AppObject appobj, int d)
        {
            var holder = LoadHolder();
            var f      = appobj as FavoriteAppObject;
            //var n = node as FavoriteItemTreeNode;
            var hld     = f.LoadHolder();
            var newCopy = hld.Clone();

            newCopy.ChangeGroup(holder.Group);
            Favorites.Move(holder, hld, newCopy, d);
            CallCompleteChanged();
            //Parent.CompleteRefresh();
            //hld.Parent.CompleteRefresh();
            Favorites.NotifyChanged();
        }
Пример #3
0
 public override void DoDelete()
 {
     base.DoDelete();
     Favorites.NotifyChanged();
 }
Пример #4
0
 public override void RenameObject(string newname)
 {
     base.RenameObject(newname);
     Favorites.NotifyChanged();
 }
Пример #5
0
 public List <FavoriteHolder> GetItems()
 {
     return(Favorites.LoadGroup(Name));
 }
Пример #6
0
        public static SaveJobResult Run(Func <Job> createJob)
        {
            if (!LicenseTool.FeatureAllowedMsg(JobsFeature.Test))
            {
                return(null);
            }
            //if (!Licenseto. Registration.TryCheckEdition(SoftwareEdition.Professional, "export to job")) return null;
            SaveJobForm win = new SaveJobForm();

            if (win.ShowDialogEx() == DialogResult.OK)
            {
                if (win.rbtCreateNewJob.Checked)
                {
                    string fn = Path.Combine(Core.JobsDirectory, win.tbxJob.Text + ".djb");
                    if (File.Exists(fn))
                    {
                        if (!StdDialog.ReallyOverwriteFile(fn))
                        {
                            return(null);
                        }
                    }
                    try
                    {
                        Job job = createJob();
                        job.SaveToFile(fn);
                        if (win.chbAddToFavorites.Checked)
                        {
                            if (String.IsNullOrEmpty(win.addToFavoritesFrame1.FavoriteName))
                            {
                                win.addToFavoritesFrame1.FavoriteName = Path.GetFileNameWithoutExtension(fn);
                            }
                            win.addToFavoritesFrame1.Favorite = new JobFavorite {
                                JobFile = fn
                            };
                            Favorites.AddLast(win.addToFavoritesFrame1.GetHolder());
                            Favorites.NotifyChanged();
                        }
                        //UsageStats.Usage("export_as_job", "jobname", job.ToString(), "addtofavorite", win.chbAddToFavorites.Checked ? "1" : "0");
                        return(new SaveJobResult
                        {
                            Commands = new List <JobCommand>(job.Root.m_commands),
                            JobConn = new JobConnection(fn),
                        });
                    }
                    catch (Exception err)
                    {
                        Errors.Report(err);
                    }
                }
                if (win.rbtAppendToExistingJob.Checked)
                {
                    string fn   = Path.Combine(Core.JobsDirectory, win.lbxJobs.Items[win.lbxJobs.SelectedIndex].ToString());
                    Job    job  = Job.LoadFromFile(fn);
                    Job    job2 = createJob();
                    job.Root.m_commands.AddRange(job2.Root.m_commands);
                    job.SaveToFile(fn);
                    return(new SaveJobResult
                    {
                        Commands = new List <JobCommand>(job2.Root.m_commands),
                        JobConn = new JobConnection(fn),
                    });
                }
            }
            return(null);
        }