Stetic.SteticMain.LoadProject C# (CSharp) Method

LoadProject() public static method

public static LoadProject ( string file ) : void
file string
return void
        public static void LoadProject(string file)
        {
            try {
                if (!CloseProject ())
                    return;

                Project.Load (file);

                string title = "Stetic - " + Path.GetFileName (file);
                MainWindow.Title = title;
                ProjectView.Fill (Project);

            } catch (Exception ex) {
                Console.WriteLine (ex);
                string msg = string.Format ("The file '{0}' could not be loaded.", file);
                msg += " " + ex.Message;
                Gtk.MessageDialog dlg = new Gtk.MessageDialog (null, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, ButtonsType.Close, msg);
                dlg.Run ();
                dlg.Destroy ();
            }
        }

Usage Example

Example #1
0
        void OpenFile(object obj, EventArgs e)
        {
            FileChooserDialog dialog =
                new FileChooserDialog(Catalog.GetString(Catalog.GetString("Open Stetic File")), null, FileChooserAction.Open,
                                      Gtk.Stock.Cancel, Gtk.ResponseType.Cancel,
                                      Gtk.Stock.Open, Gtk.ResponseType.Ok);
            int response = dialog.Run();

            if (response == (int)Gtk.ResponseType.Ok)
            {
                SteticMain.LoadProject(dialog.Filename);
                AddRecentFile(dialog.Filename);
            }
            dialog.Hide();
        }
All Usage Examples Of Stetic.SteticMain::LoadProject