Stetic.SteticMain.SaveProjectAs C# (CSharp) Method

SaveProjectAs() public static method

public static SaveProjectAs ( ) : bool
return bool
        public static bool SaveProjectAs()
        {
            FileChooserDialog dialog =
                new FileChooserDialog (Catalog.GetString ("Save Stetic File As"), null, FileChooserAction.Save,
                               Gtk.Stock.Cancel, Gtk.ResponseType.Cancel,
                               Gtk.Stock.Save, Gtk.ResponseType.Ok);

            if (Project.FileName != null)
                dialog.CurrentName = Project.FileName;

            int response = dialog.Run ();
            if (response == (int)Gtk.ResponseType.Ok) {
                string name = dialog.Filename;
                if (System.IO.Path.GetExtension (name) == "")
                    name = name + ".stetic";
                try {
                    Project.Save (name);
                    Project.Modified = false;
                    SteticMain.UIManager.AddRecentFile (name);
                } catch (Exception ex) {
                    ReportError (Catalog.GetString ("The project could not be saved."), ex);
                    return false;
                }
            }
            dialog.Hide ();
            return true;
        }

Usage Example

Example #1
0
 void SaveFileAs(object obj, EventArgs e)
 {
     SteticMain.SaveProjectAs();
 }