void Load() { if (gproject != null || disposed || fileName == null) { return; } gproject = GuiBuilderService.SteticApp.CreateProject(); formInfos = new List <GuiBuilderWindow> (); if (!System.IO.File.Exists(fileName)) { // Regenerate the gtk-gui folder if the stetic project // doesn't exist. GtkDesignInfo.FromProject(project).UpdateGtkFolder(); } try { gproject.Load(fileName); } catch (Exception ex) { MessageService.ShowException(ex, GettextCatalog.GetString("The GUI designer project file '{0}' could not be loaded.", fileName)); hasError = true; } Counters.SteticProjectsLoaded++; gproject.ResourceProvider = GtkDesignInfo.FromProject(project).ResourceProvider; gproject.WidgetAdded += OnAddWidget; gproject.WidgetRemoved += OnRemoveWidget; gproject.ActionGroupsChanged += OnGroupsChanged; project.FileAddedToProject += OnFileAdded; project.FileRemovedFromProject += OnFileRemoved; project.ReferenceAddedToProject += OnReferenceAdded; project.ReferenceRemovedFromProject += OnReferenceRemoved; foreach (Stetic.WidgetInfo ob in gproject.Widgets) { RegisterWindow(ob, false); } // Monitor changes in the file lastSaveTime = System.IO.File.GetLastWriteTime(fileName); watcher = new FileSystemWatcher(); if (System.IO.File.Exists(fileName)) { watcher.Path = Path.GetDirectoryName(fileName); watcher.Filter = Path.GetFileName(fileName); watcher.Changed += (FileSystemEventHandler)DispatchService.GuiDispatch(new FileSystemEventHandler(OnSteticFileChanged)); watcher.EnableRaisingEvents = true; } }
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(); } }
void Load() { if (gproject != null || disposed || folderName == null) { return; } GtkDesignInfo info = GtkDesignInfo.FromProject(project); gproject = GuiBuilderService.SteticApp.CreateProject(info); formInfos = new List <GuiBuilderWindow> (); // TODO : when expanding project, UpdateGtkFolder causes in throwing exception by gtk // info.UpdateGtkFolder (); try { gproject.Load(folderName); } catch (Exception ex) { MessageService.ShowException(ex, GettextCatalog.GetString("The GUI designer project folder '{0}' could not be loaded.", folderName)); hasError = true; } Counters.SteticProjectsLoaded++; gproject.ResourceProvider = GtkDesignInfo.FromProject(project).ResourceProvider; // gproject.DesignInfo = info; gproject.WidgetAdded += OnAddWidget; gproject.WidgetRemoved += OnRemoveWidget; gproject.ActionGroupsChanged += OnGroupsChanged; project.FileAddedToProject += OnFileAdded; project.FileRemovedFromProject += OnFileRemoved; project.ReferenceAddedToProject += OnReferenceAdded; project.ReferenceRemovedFromProject += OnReferenceRemoved; foreach (Stetic.WidgetInfo ob in gproject.Widgets) { RegisterWindow(ob, false); } }
void Load () { if (gproject != null || disposed || fileName == null) return; gproject = GuiBuilderService.SteticApp.CreateProject (); formInfos = new List<GuiBuilderWindow> (); if (!System.IO.File.Exists (fileName)) { // Regenerate the gtk-gui folder if the stetic project // doesn't exist. GtkDesignInfo.FromProject (project).UpdateGtkFolder (); } try { gproject.Load (fileName); } catch (Exception ex) { MessageService.ShowException (ex, GettextCatalog.GetString ("The GUI designer project file '{0}' could not be loaded.", fileName)); hasError = true; } Counters.SteticProjectsLoaded++; gproject.ResourceProvider = GtkDesignInfo.FromProject (project).ResourceProvider; gproject.WidgetAdded += OnAddWidget; gproject.WidgetRemoved += OnRemoveWidget; gproject.ActionGroupsChanged += OnGroupsChanged; project.FileAddedToProject += OnFileAdded; project.FileRemovedFromProject += OnFileRemoved; project.ReferenceAddedToProject += OnReferenceAdded; project.ReferenceRemovedFromProject += OnReferenceRemoved; foreach (Stetic.WidgetInfo ob in gproject.Widgets) RegisterWindow (ob, false); // Monitor changes in the file lastSaveTime = System.IO.File.GetLastWriteTime (fileName); watcher = new FileSystemWatcher (); if (System.IO.File.Exists (fileName)) { watcher.Path = Path.GetDirectoryName (fileName); watcher.Filter = Path.GetFileName (fileName); watcher.Changed += (FileSystemEventHandler) DispatchService.GuiDispatch (new FileSystemEventHandler (OnSteticFileChanged)); watcher.EnableRaisingEvents = true; } }
void Load () { if (gproject != null || disposed || folderName == null) return; GtkDesignInfo info = GtkDesignInfo.FromProject (project); gproject = GuiBuilderService.SteticApp.CreateProject (info); formInfos = new List<GuiBuilderWindow> (); // TODO : when expanding project, UpdateGtkFolder causes in throwing exception by gtk // info.UpdateGtkFolder (); try { gproject.Load (folderName); } catch (Exception ex) { MessageService.ShowException (ex, GettextCatalog.GetString ("The GUI designer project folder '{0}' could not be loaded.", folderName)); hasError = true; } Counters.SteticProjectsLoaded++; gproject.ResourceProvider = GtkDesignInfo.FromProject (project).ResourceProvider; // gproject.DesignInfo = info; gproject.WidgetAdded += OnAddWidget; gproject.WidgetRemoved += OnRemoveWidget; gproject.ActionGroupsChanged += OnGroupsChanged; project.FileAddedToProject += OnFileAdded; project.FileRemovedFromProject += OnFileRemoved; project.ReferenceAddedToProject += OnReferenceAdded; project.ReferenceRemovedFromProject += OnReferenceRemoved; foreach (Stetic.WidgetInfo ob in gproject.Widgets) RegisterWindow (ob, false); }