Пример #1
0
 protected override void RemoveSelected()
 {
     if (Project != null)
     {
         var msg = Catalog.GetString("You are about to delete a player and all " +
                                     "its tags. Do you want to proceed?");
         if (MessagesHelpers.QuestionMessage(this, msg))
         {
             try {
                 foreach (var player in selected)
                 {
                     Project.RemovePlayer(template, player);
                 }
             } catch {
                 MessagesHelpers.WarningMessage(this,
                                                Catalog.GetString("A template needs at least one category"));
             }
         }
     }
     else
     {
         try {
             foreach (var player in selected)
             {
                 Template.Remove(player);
             }
         } catch {
             MessagesHelpers.WarningMessage(this,
                                            Catalog.GetString("A template needs at least one category"));
         }
     }
     base.RemoveSelected();
 }
Пример #2
0
 void HandleDeleteTeamClicked(object sender, EventArgs e)
 {
     if (loadedTeam != null)
     {
         if (loadedTeam.Static)
         {
             string msg = Catalog.GetString("System teams can't be deleted");
             MessagesHelpers.WarningMessage(this, msg);
             return;
         }
         else
         {
             string msg = Catalog.GetString("Do you really want to delete the template: ") + loadedTeam.Name;
             if (MessagesHelpers.QuestionMessage(this, msg, null))
             {
                 provider.Delete(loadedTeam.Name);
                 teams.Remove(ref selectedIter);
                 templatesNames.Remove(loadedTeam.Name);
                 selectedIter = TreeIter.Zero;
                 teamseditortreeview.Selection.SelectPath(new TreePath("0"));
                 HandleSelectionChanged(null, null);
             }
         }
     }
 }
Пример #3
0
        protected void OnDelbuttonClicked(object sender, System.EventArgs e)
        {
            TreeIter  iter;
            IDatabase db;

            treeview.Selection.GetSelected(out iter);
            db = store.GetValue(iter, 0) as IDatabase;

            if (db == manager.ActiveDB)
            {
                var msg = Catalog.GetString("This database is the active one and can't be deleted");
                MessagesHelpers.ErrorMessage(this, msg);
                return;
            }

            if (db != null)
            {
                var msg = Catalog.GetString("Do you really want to delete the database: " + db.Name);
                if (MessagesHelpers.QuestionMessage(this, msg))
                {
                    db.Backup();
                    manager.Delete(db);
                    store.Remove(ref iter);
                }
            }
        }
Пример #4
0
        protected override void OnExportbuttonClicked(object sender, System.EventArgs e)
        {
            EntryDialog dialog = new EntryDialog();

            dialog.TransientFor = (Gtk.Window) this.Toplevel;
            dialog.ShowCount    = false;
            dialog.Text         = Catalog.GetString("New template");
            if (dialog.Run() == (int)ResponseType.Ok)
            {
                if (dialog.Text == "")
                {
                    MessagesHelpers.ErrorMessage(dialog, Catalog.GetString("The template name is void."));
                }
                else if (provider.Exists(dialog.Text))
                {
                    var msg = Catalog.GetString("The template already exists. " +
                                                "Do you want to overwrite it ?");
                    if (MessagesHelpers.QuestionMessage(this, msg))
                    {
                        Template.Name = dialog.Text;
                        provider.Update(Template);
                    }
                }
                else
                {
                    Template.Name = dialog.Text;
                    provider.Save(Template);
                }
            }
            dialog.Destroy();
        }
Пример #5
0
 protected override void RemoveSelected()
 {
     if (Project != null)
     {
         var msg = Catalog.GetString("You are about to delete a category and all the plays added to this category. Do you want to proceed?");
         if (MessagesHelpers.QuestionMessage(this, msg))
         {
             try {
                 foreach (var cat in selected)
                 {
                     Project.RemoveCategory(cat);
                 }
             } catch {
                 MessagesHelpers.WarningMessage(this,
                                                Catalog.GetString("A template needs at least one category"));
             }
         }
     }
     else
     {
         foreach (Category cat in selected)
         {
             if (template.Count == 1)
             {
                 MessagesHelpers.WarningMessage(this,
                                                Catalog.GetString("A template needs at least one category"));
             }
             else
             {
                 template.Remove(cat);
             }
         }
     }
     base.RemoveSelected();
 }
Пример #6
0
        protected virtual void OnDeleteButtonPressed(object sender, System.EventArgs e)
        {
            List <ProjectDescription> deletedProjects = new List <ProjectDescription>();

            if (selectedProjects == null)
            {
                return;
            }

            foreach (ProjectDescription selectedProject in selectedProjects)
            {
                if (openedProject != null &&
                    selectedProject.File.FilePath == openedProject.Description.File.FilePath)
                {
                    MessagesHelpers.WarningMessage(this,
                                                   Catalog.GetString("This Project is actually in use.") + "\n" +
                                                   Catalog.GetString("Close it first to allow its removal from the database"));
                    continue;
                }
                var msg = Catalog.GetString("Do you really want to delete:") + "\n" + selectedProject.Title;
                if (MessagesHelpers.QuestionMessage(this, msg))
                {
                    DB.RemoveProject(selectedProject.UUID);
                    deletedProjects.Add(selectedProject);
                }
            }
            projectlistwidget1.RemoveProjects(deletedProjects);
            Clear();
        }
Пример #7
0
 public bool QuestionMessage(string question, string title, object parent = null)
 {
     if (parent == null)
     {
         parent = mainWindow as Widget;
     }
     return(MessagesHelpers.QuestionMessage(parent as Widget, question, title));
 }
Пример #8
0
        void HandleClearClicked(object sender, EventArgs e)
        {
            string msg = Catalog.GetString("Do you want to clear the drawing?");

            if (MessagesHelpers.QuestionMessage(this, msg))
            {
                blackboard.Clear();
            }
        }
Пример #9
0
        void Clear()
        {
            string msg = Catalog.GetString("Do you want to clear the drawing?");

            if (MessagesHelpers.QuestionMessage(this, msg))
            {
                blackboard.Clear();
            }
        }
Пример #10
0
        void HandleCloseClicked(object sender, EventArgs e)
        {
            string msg = Catalog.GetString("Do you want to close and cancel the current capture?");

            if (MessagesHelpers.QuestionMessage(this, msg))
            {
                Config.EventsBroker.EmitCaptureFinished(true);
            }
        }
Пример #11
0
        private void PromptToSaveEditedProject()
        {
            var msg = Catalog.GetString("The Project has been edited, do you want to save the changes?");

            if (MessagesHelpers.QuestionMessage(this, msg))
            {
                SaveProject();
                projectdetails.Edited = false;
            }
        }
Пример #12
0
        void HandleDeleteEvent(object o, DeleteEventArgs args)
        {
            string msg = Catalog.GetString("Do you want to close the current drawing?");

            if (MessagesHelpers.QuestionMessage(this, msg))
            {
                args.RetVal = false;
            }
            else
            {
                args.RetVal = true;
            }
        }
Пример #13
0
 protected virtual void OnSubcategoriesDeleted(List <ISubCategory> subcats)
 {
     if (Project != null)
     {
         var msg = Catalog.GetString("If you delete this subcategory you will loose" +
                                     "all the tags associated with it. Do you want to proceed?");
         if (!MessagesHelpers.QuestionMessage(this, msg))
         {
             return;
         }
         Project.DeleteSubcategoryTags(Category, subcats);
     }
     Category.SubCategories.RemoveAll(s => subcats.Contains(s));
 }
Пример #14
0
        void HandleCloseClicked(object sender, EventArgs e)
        {
            string msg = Catalog.GetString("Do you want to close and cancel the current capture?");

            if (MessagesHelpers.QuestionMessage(this, msg))
            {
                App.Current.EventsBroker.Publish <CaptureFinishedEvent> (
                    new CaptureFinishedEvent {
                    Cancel = true,
                    Reopen = false
                }
                    );
            }
        }
Пример #15
0
 void HandleDeleteTemplateClicked(object sender, EventArgs e)
 {
     if (loadedTemplate != null)
     {
         string msg = Catalog.GetString("Do you really want to delete the dashboard: ") + loadedTemplate.Name;
         if (MessagesHelpers.QuestionMessage(this, msg, null))
         {
             provider.Delete(loadedTemplate.Name);
             templates.Remove(ref selectedIter);
             templatesNames.Remove(loadedTemplate.Name);
             selectedIter = TreeIter.Zero;
             dashboardseditortreeview.Selection.SelectPath(new TreePath("0"));
             HandleSelectionChanged(null, null);
         }
     }
 }
Пример #16
0
        protected void OnDeleteKeyFrame(object obj, EventArgs args)
        {
            var msg = Catalog.GetString("Do you want to delete the key frame for this play?");

            if (MessagesHelpers.QuestionMessage(Toplevel, msg))
            {
                TreePath[] paths = Selection.GetSelectedRows();
                for (int i = 0; i < paths.Length; i++)
                {
                    Play tNode = (Play)GetValueFromPath(paths[i]);
                    tNode.Drawings.Clear();
                }
                // Refresh the thumbnails
                QueueDraw();
            }
        }
Пример #17
0
        void DeviceChanged(int deviceID)
        {
            string msg;

            /* device disconnected, pause capture */
            if (deviceID == -1)
            {
                PausePeriod();
                msg = Catalog.GetString("Device disconnected. " + "The capture will be paused");
                MessagesHelpers.WarningMessage(this, msg);
            }
            else
            {
                msg = Catalog.GetString("Device reconnected. " + "Do you want to restart the capture?");
                if (MessagesHelpers.QuestionMessage(this, msg, null))
                {
                    ResumePeriod();
                }
            }
        }
Пример #18
0
        void HandleDeleteClicked(object sender, EventArgs e)
        {
            List <ProjectDescription> deletedProjects;

            if (selectedProjects == null)
            {
                return;
            }

            deletedProjects = new List <ProjectDescription> ();
            foreach (ProjectDescription selectedProject in selectedProjects)
            {
                if (openedProject != null && openedProject.ID == selectedProject.ProjectID)
                {
                    MessagesHelpers.WarningMessage(this,
                                                   Catalog.GetString("This Project is actually in use.") + "\n" +
                                                   Catalog.GetString("Close it first to allow its removal from the database"));
                    continue;
                }
                string msg = Catalog.GetString("Do you really want to delete:") + "\n" + selectedProject.Title;
                if (MessagesHelpers.QuestionMessage(this, msg))
                {
                    // Unload first
                    if (loadedProject != null && loadedProject.ID == selectedProject.ProjectID)
                    {
                        loadedProject = null;
                    }
                    DB.RemoveProject(selectedProject.ProjectID);
                    deletedProjects.Add(selectedProject);
                }
            }
            projectlistwidget1.RemoveProjects(deletedProjects);

            // In the case where there are no projects left we need to clear the project desc widget
            if (DB.GetAllProjects().Count == 0)
            {
                rbox.Visible = false;
            }
        }
Пример #19
0
        void HandleNewTemplateClicked(object sender, EventArgs e)
        {
            bool create = false;
            bool force  = false;

            EntryDialog dialog = new EntryDialog(Toplevel as Gtk.Window);

            dialog.ShowCount          = true;
            dialog.Text               = Catalog.GetString("New dasboard");
            dialog.CountText          = Catalog.GetString("Event types:");
            dialog.AvailableTemplates = templatesNames;

            while (dialog.Run() == (int)ResponseType.Ok)
            {
                if (dialog.Text == "")
                {
                    MessagesHelpers.ErrorMessage(dialog, Catalog.GetString("The dashboard name is empty."));
                    continue;
                }
                else if (provider.Exists(dialog.Text))
                {
                    var msg = Catalog.GetString("The dashboard already exists. " +
                                                "Do you want to overwrite it?");
                    if (MessagesHelpers.QuestionMessage(this, msg))
                    {
                        create = true;
                        force  = true;
                        break;
                    }
                }
                else
                {
                    create = true;
                    break;
                }
            }

            if (create)
            {
                if (force)
                {
                    try {
                        provider.Delete(dialog.Text);
                    } catch {
                    }
                }
                if (dialog.SelectedTemplate != null)
                {
                    try {
                        provider.Copy(dialog.SelectedTemplate, dialog.Text);
                    } catch (InvalidTemplateFilenameException ex) {
                        Config.GUIToolkit.ErrorMessage(ex.Message, this);
                        dialog.Destroy();
                        return;
                    }
                }
                else
                {
                    Dashboard template;
                    template      = Dashboard.DefaultTemplate(dialog.Count);
                    template.Name = dialog.Text;
                    if (!SaveTemplate(template))
                    {
                        dialog.Destroy();
                        return;
                    }
                }
                Load(dialog.Text);
            }
            dialog.Destroy();
        }
Пример #20
0
        protected virtual void OnOpenbuttonClicked(object sender, System.EventArgs e)
        {
            if (useType == ProjectType.CaptureProject || useType == ProjectType.URICaptureProject)
            {
                string filename;

                filename = FileChooserHelper.SaveFile(this, Catalog.GetString("Output file"),
                                                      "Capture.mp4", Config.VideosDir, "MP4",
                                                      new string[] { "*.mp4" });
                if (filename != null)
                {
                    fileEntry.Text = System.IO.Path.ChangeExtension(filename, "mp4");
                }
            }
            else
            {
                MessageDialog md = null;
                string        folder, filename;

                folder   = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                filename = FileChooserHelper.OpenFile(this, Catalog.GetString("Open file"),
                                                      null, folder, null, null);
                if (filename == null)
                {
                    return;
                }

                try {
                    md = new MessageDialog((Gtk.Window) this.Toplevel,
                                           DialogFlags.Modal,
                                           MessageType.Info,
                                           Gtk.ButtonsType.None,
                                           Catalog.GetString("Analyzing video file:") + "\n" + filename);
                    md.Icon = Stetic.IconLoader.LoadIcon(this, "longomatch", Gtk.IconSize.Dialog);
                    md.Show();

                    mFile = PreviewMediaFile.DiscoverFile(filename);
                    if (!mFile.HasVideo || mFile.VideoCodec == "")
                    {
                        throw new Exception(Catalog.GetString("This file doesn't contain a video stream."));
                    }
                    if (mFile.HasVideo && mFile.Length == 0)
                    {
                        throw new Exception(Catalog.GetString("This file contains a video stream but its length is 0."));
                    }
                    if (GStreamer.FileNeedsRemux(mFile))
                    {
                        string q = Catalog.GetString("The file you are trying to load is not properly supported. " +
                                                     "Would you like to convert it into a more suitable format?");
                        if (MessagesHelpers.QuestionMessage(this, q))
                        {
                            var remux       = new Remuxer(mFile);
                            var newFilename = remux.Remux(this.Toplevel as Gtk.Window);
                            if (newFilename != null)
                            {
                                mFile = PreviewMediaFile.DiscoverFile(newFilename);
                            }
                        }
                    }
                    fileEntry.Text = mFile.FilePath;
                }
                catch (Exception ex) {
                    MessagesHelpers.ErrorMessage(this, ex.Message);
                }
                finally {
                    md.Destroy();
                }
            }
        }
Пример #21
0
        void HandleNewTeamClicked(object sender, EventArgs e)
        {
            bool create = false;
            bool force  = false;

            EntryDialog dialog = new EntryDialog(Toplevel as Gtk.Window);

            dialog.ShowCount          = true;
            dialog.Text               = Catalog.GetString("New team");
            dialog.AvailableTemplates = templatesNames;

            while (dialog.Run() == (int)ResponseType.Ok)
            {
                if (dialog.Text == "")
                {
                    MessagesHelpers.ErrorMessage(dialog, Catalog.GetString("The template name is empty."));
                    continue;
                }
                else if (dialog.Text == "default")
                {
                    MessagesHelpers.ErrorMessage(dialog, Catalog.GetString("The template can't be named 'default'."));
                    continue;
                }
                else if (provider.Exists(dialog.Text))
                {
                    var msg = Catalog.GetString("The template already exists. " +
                                                "Do you want to overwrite it?");
                    if (MessagesHelpers.QuestionMessage(this, msg))
                    {
                        create = true;
                        force  = true;
                        break;
                    }
                }
                else
                {
                    create = true;
                    break;
                }
            }

            if (create)
            {
                if (force)
                {
                    try {
                        provider.Delete(dialog.Text);
                    } catch (Exception ex) {
                        Log.Exception(ex);
                    }
                }
                if (dialog.SelectedTemplate != null)
                {
                    provider.Copy(dialog.SelectedTemplate, dialog.Text);
                }
                else
                {
                    Team team;
                    team          = Team.DefaultTemplate(dialog.Count);
                    team.TeamName = dialog.Text;
                    team.Name     = dialog.Text;
                    if (!SaveTemplate(team))
                    {
                        dialog.Destroy();
                        return;
                    }
                }
                Load(dialog.Text);
            }
            dialog.Destroy();
        }
Пример #22
0
        public Task <bool> QuestionMessage(string question, string title, object parent = null)
        {
            bool res = MessagesHelpers.QuestionMessage(GetParentWidget(parent), question, title);

            return(AsyncHelpers.Return(res));
        }