/// <summary> /// Main form initialization method performs operations that may need the main /// window to have already been shown since we may invoke its UI handlers /// </summary> public void Initialize() { // Load default set of repositories ClassWorkspace.Load(null); // Load custom tools App.CustomTools = ClassCustomTools.Load(DefaultCustomToolsFile); // If there are no tools on the list, find some local tools and add them if (App.CustomTools.Tools.Count == 0) { App.CustomTools.Tools.AddRange(ClassCustomTools.FindLocalTools()); } // If there is no current repo, switch the right panel view to Repos // Otherwise, restore the last view panel ChangeRightPanel(App.Repos.Current == null ? "Repos" : Properties.Settings.Default.viewRightPanel); // Usability improvement: When starting the app, check if the global user name // and email are defined and if not, open the settings dialog. This helps when // starting the app for the first time. if (string.IsNullOrEmpty(ClassConfig.GetGlobal("user.name")) && string.IsNullOrEmpty(ClassConfig.GetGlobal("user.email"))) { MenuOptions(null, null); } }
/// <summary> /// Main form initialization method performs operations that may need the main /// window to have already been shown since we may invoke its UI handlers /// </summary> public bool Initialize() { // Load default set of repositories // If this is the first time run, initialize the default workspace file name if (string.IsNullOrEmpty(Properties.Settings.Default.WorkspaceFile)) { Properties.Settings.Default.WorkspaceFile = Path.Combine(App.AppHome, "repos.giw"); } string name = Properties.Settings.Default.WorkspaceFile; if (File.Exists(name)) // Even if the workspace does not exist at this point { if (!ClassWorkspace.Load(name)) // still use it's name and continue running since it { return(false); // will be saved on a program exit } } // Load custom tools App.CustomTools = ClassCustomTools.Load(DefaultCustomToolsFile); // If there are no tools on the list, find some local tools and add them if (App.CustomTools.Tools.Count == 0) { App.CustomTools.Tools.AddRange(ClassCustomTools.FindLocalTools()); } // If there is no current repo, switch the right panel view to Repos // Otherwise, restore the last view panel ChangeRightPanel(App.Repos.Current == null ? "Repos" : Properties.Settings.Default.viewRightPanel); // Usability improvement: When starting the app, check if the global user name // and email are defined and if not, open the settings dialog. This helps when // starting the app for the first time. if (string.IsNullOrEmpty(ClassConfig.GetGlobal("user.name")) && string.IsNullOrEmpty(ClassConfig.GetGlobal("user.email"))) { MenuOptions(null, null); } return(true); }
/// <summary> /// Main form initialization method performs operations that may need the main /// window to have already been shown since we may invoke its UI handlers /// Optionally, open an existing git repo at the path given in the initRepo argument /// </summary> public bool Initialize(string initRepo) { // Load default set of repositories // If this is the first time run, initialize the default workspace file name if (string.IsNullOrEmpty(Properties.Settings.Default.WorkspaceFile)) { Properties.Settings.Default.WorkspaceFile = Path.Combine(App.AppHome, "repos.giw"); } string name = Properties.Settings.Default.WorkspaceFile; if (File.Exists(name)) // Even if the workspace does not exist at this point { if (!ClassWorkspace.Load(name)) // still use it's name and continue running since it { return(false); // will be saved on a program exit } } // Load custom tools App.CustomTools = ClassCustomTools.Load(DefaultCustomToolsFile); // If there are no tools on the list, find some local tools and add them if (App.CustomTools.Tools.Count == 0) { App.CustomTools.Tools.AddRange(ClassCustomTools.FindLocalTools()); } // If there is no current repo, switch the right panel view to Repos // Otherwise, restore the last view panel ChangeRightPanel(App.Repos.Current == null ? "Repos" : Properties.Settings.Default.viewRightPanel); // The user requested to open a specific repo with the --repo command line argument if (initRepo != null) { try { ClassRepo repo = App.Repos.Find(initRepo); if (repo == null) { repo = App.Repos.Add(ClassCommandLine.initRepo); } App.Repos.SetCurrent(repo); ChangeRightPanel("Revisions"); // Set the right pane to "Revisions" tab App.PrintStatusMessage("Opening repo " + repo, MessageType.General); } catch (Exception ex) { App.PrintLogMessage("Unable to open repo: " + ex.Message, MessageType.Error); App.PrintStatusMessage(ex.Message, MessageType.Error); } } // Usability improvement: When starting the app, check if the global user name // and email are defined and if not, open the settings dialog. This helps when // starting the app for the first time. if (string.IsNullOrEmpty(ClassConfig.GetGlobal("user.name")) && string.IsNullOrEmpty(ClassConfig.GetGlobal("user.email"))) { MenuOptions(null, null); } return(true); }