public void Initalize() { //Reset our settings memento before we start _memento = _settings.GetMemento(); //Set up the view ISetting url = _settings.Get(YurtleTrackPlugin.URLOPTIONNAME); if (url != null) { _view.URL = url.Value; } else { _view.URL = string.Empty; } ISetting user = _settings.Get(YurtleTrackPlugin.USEROPTIONNAME); if (url != null) { _view.UserName = user.Value; } else { _view.UserName = string.Empty; } ISetting pass = _settings.Get(YurtleTrackPlugin.PASSWORDOPTIONNAME); if (url != null) { _view.Password = pass.Value; } else { _view.Password = string.Empty; } }
public string GetCommitMessage2(IntPtr hParentWnd, string parameters, string commonURL, string commonRoot, string[] pathList, string originalMessage, string bugID, out string bugIDOut, out string[] revPropNames, out string[] revPropValues) { try { Cursor.Current = Cursors.AppStarting; revPropNames = new string[0]; revPropValues = new string[0]; bugIDOut = string.Empty; _selectedBugs = new List <IBug>(); ISettingsOriginator originator = RestoreFromParameters(parameters); _kernel.Rebind <IBugService>().ToConstructor <YouTrackBugService>(svc => new YouTrackBugService(svc.Inject <IHttpWebRequestFactory>(), originator.Get(YurtleTrackPlugin.URLOPTIONNAME).Value, originator.Get(YurtleTrackPlugin.USEROPTIONNAME).Value, originator.Get(YurtleTrackPlugin.PASSWORDOPTIONNAME).Value)); _kernel.Rebind <ISettingsOriginator>().ToConstant(originator).Named("Parameters"); ISettingsOriginator viewSettingsOriginator = RestoreFromCurrentUserSettings(); FormBugListView vw = _kernel.Get <FormBugListView>(new ConstructorArgument("viewSettings", viewSettingsOriginator)); _kernel.Rebind <ISettingsOriginator>().ToConstant(viewSettingsOriginator).Named("ViewSettings"); DialogResult ret = vw.ShowDialog(); //Save view settings SaveCurrentUserSettings(viewSettingsOriginator); if (ret != DialogResult.OK) { return(originalMessage); } StringBuilder sb = new StringBuilder(originalMessage); if (!String.IsNullOrEmpty(originalMessage) && !originalMessage.EndsWith("\n")) { sb.AppendLine(); } if (vw.SelectedBugs != null && vw.SelectedBugs.Count > 0) { foreach (IBug bug in vw.SelectedBugs) { sb.AppendFormat("Fixed #{0} : {1}", bug.ID, bug.Summary); sb.AppendLine(); } //end foreach _selectedBugs.AddRange(vw.SelectedBugs); if (vw.ApplyCommand) { _commandsToProcess.Add(vw.CommandToApply); } } //end if return(sb.ToString()); } catch // (Exception ex) { //MessageBox.Show(ex.ToString()); throw; } finally { Cursor.Current = Cursors.Default; } }
protected override void OnLoad(EventArgs e) { _settingsLoaded = false; try { _presenter.Initialize(); //Load some view settings ISetting locationX = _viewSettings.Get("LocationX"); ISetting locationY = _viewSettings.Get("LocationY"); ISetting sizeWidth = _viewSettings.Get("SizeWidth"); ISetting sizeHeight = _viewSettings.Get("SizeHeight"); ISetting projectID = _viewSettings.Get("LastProjectID"); ISetting command = _viewSettings.Get("LastCommandText"); ISetting useCommand = _viewSettings.Get("LastUseCommand"); if (locationX != null && locationY != null) { this.DesktopLocation = new Point(Convert.ToInt32(locationX.Value), Convert.ToInt32(locationY.Value)); } else { this.StartPosition = FormStartPosition.CenterParent; } if (sizeWidth != null && sizeHeight != null) { this.Size = new Size(Convert.ToInt32(sizeWidth.Value), Convert.ToInt32(sizeHeight.Value)); } if (projectID != null) { IProject proj = Projects.FirstOrDefault(p => p.ID == projectID.Value); if (proj != null) { bindingSourceProjects.Position = bindingSourceProjects.IndexOf(proj); } } //end if if (command != null) { CommandToApply = new YouTrackCommand() { Command = command.Value, DisableNotifications = false } } ; if (useCommand != null) { try { ApplyCommand = bool.Parse(useCommand.Value); } catch { ApplyCommand = false; } } //end if //Successfully loaded settings _settingsLoaded = true; } catch (Exception ex) { MessageBox.Show(ex.Message); throw; } //end try base.OnLoad(e); }