Пример #1
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();
        }
Пример #2
0
        void HandlePeriodsClicked(object sender, EventArgs e)
        {
            string        res, desc;
            List <string> periods;

            desc = Catalog.GetString("Game periods") + " (eg: 1 2 ex1 ex2) ";
            res  = MessagesHelpers.QueryMessage(this, desc, "", String.Join(" ", Template.GamePeriods));
            if (res == null)
            {
                return;
            }

            periods = new List <string> (res.Split(' '));
            if (periods.Count == 0)
            {
                string msg = Catalog.GetString("Invalid content. Periods must be separated by spaces " +
                                               "(\"1 2 ex1 ex2\")");
                MessagesHelpers.ErrorMessage(this, msg);
            }
            else
            {
                Template.GamePeriods = periods;
                periodsLabel.Text    = String.Join(" - ", periods);
            }
        }
Пример #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 virtual void OnMultimediaError(object o, string message)
 {
     MessagesHelpers.ErrorMessage(this,
                                  Catalog.GetString("The following error happened and" +
                                                    " the current project will be closed:") + "\n" + message);
     EmitCloseOpenedProject(true);
 }
Пример #5
0
        private static void ProcessExecutionError(Exception ex)
        {
            string logFile = Constants.SOFTWARE_NAME + "-" + DateTime.Now + ".log";
            string message;

            logFile = logFile.Replace("/", "-");
            logFile = logFile.Replace(" ", "-");
            logFile = logFile.Replace(":", "-");
            logFile = System.IO.Path.Combine(Config.HomeDir, logFile);

            message = SysInfo.PrintInfo(Assembly.GetExecutingAssembly().GetName().Version);
            if (ex.InnerException != null)
            {
                message += String.Format("{0}\n{1}\n{2}\n{3}\n{4}", ex.Message, ex.InnerException.Message, ex.Source, ex.StackTrace, ex.InnerException.StackTrace);
            }
            else
            {
                message += String.Format("{0}\n{1}\n{2}", ex.Message, ex.Source, ex.StackTrace);
            }

            using (StreamWriter s = new StreamWriter(logFile)) {
                s.WriteLine(message);
                s.WriteLine("\n\n\nStackTrace:");
                s.WriteLine(System.Environment.StackTrace);
            }
            Log.Exception(ex);
            //TODO Add bug reports link
            MessagesHelpers.ErrorMessage(null,
                                         Catalog.GetString("The application has finished with an unexpected error.") + "\n" +
                                         Catalog.GetString("A log has been saved at: ") + logFile + "\n" +
                                         Catalog.GetString("Please, fill a bug report "));

            Application.Quit();
        }
Пример #6
0
 public void ErrorMessage(string message, object parent = null)
 {
     if (parent == null)
     {
         parent = mainWindow as Widget;
     }
     MessagesHelpers.ErrorMessage(parent as Widget, message);
 }
Пример #7
0
        protected void OnBackupbuttonClicked(object sender, System.EventArgs e)
        {
            IDatabase db = SelectedDB;

            if (db != null)
            {
                if (db.Backup())
                {
                    MessagesHelpers.InfoMessage(this, Catalog.GetString("Backup successfull"));
                }
                else
                {
                    MessagesHelpers.ErrorMessage(this, Catalog.GetString("Could not create backup"));
                }
            }
        }
Пример #8
0
        private static void ProcessExecutionError(Exception ex)
        {
            string logFile = Constants.SOFTWARE_NAME + "-" + DateTime.Now + ".log";

            logFile = Utils.SanitizePath(logFile, ' ', ':');
            logFile = Path.Combine(Config.HomeDir, logFile);
            Log.Information(SysInfo.PrintInfo(Assembly.GetExecutingAssembly().GetName().Version));
            Log.Exception(ex);
            File.Copy(Config.LogFile, logFile);

            //TODO Add bug reports link
            MessagesHelpers.ErrorMessage(null,
                                         Catalog.GetString("The application has finished with an unexpected error.") + "\n" +
                                         Catalog.GetString("A log has been saved at: ") + logFile + "\n" +
                                         Catalog.GetString("Please, fill a bug report "));
            Application.Quit();
        }
Пример #9
0
        protected void OnAddbuttonClicked(object sender, System.EventArgs e)
        {
            IDatabase db;
            string    dbname = MessagesHelpers.QueryMessage(this, Catalog.GetString("Database name"));

            if (dbname == null || dbname == "")
            {
                return;
            }

            if (manager.Databases.Where(d => d.Name == dbname).Count() != 0)
            {
                var msg = Catalog.GetString("A database already exists with this name");
                MessagesHelpers.ErrorMessage(this, msg);
                return;
            }

            db = manager.Add(dbname);
            if (db != null)
            {
                store.AppendValues(db);
            }
        }
Пример #10
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();
                }
            }
        }
Пример #11
0
 public void ErrorMessage(string message, object parent = null)
 {
     MessagesHelpers.ErrorMessage(GetParentWidget(parent), message);
 }
Пример #12
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();
        }
Пример #13
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();
        }