private void RegenerateForm(ITrackedItemType newType) { Dictionary <IField, object> initialValues = new Dictionary <IField, object>(); this.type = newType; IField field1 = newType.GetField(ItemField.Title); if (field1 != null) { initialValues.Add(field1, (object)this.defaultTitle); } IField field2 = newType.GetField(ItemField.Description); if (field2 != null) { initialValues.Add(field2, (object)this.defaultDescription); } IField field3 = newType.GetField(ItemField.ReproSteps); if (field3 != null) { initialValues.Add(field3, (object)this.defaultDescription.Replace(Environment.NewLine, "<br />")); } this.RegistrationForm = newType.ProductGroup.GenerateWorkItemForm(newType, initialValues, this.fileAttachments); this.BugForm.Child = (UIElement)this.RegistrationForm; this.RegisterItemDialog_SizeChanged((object)null, (SizeChangedEventArgs)null); }
private void DetermineItemType() { if (this.FilteredItemTypes.Count <= 0) { return; } SelectTemplateDialog selectTemplateDialog = new SelectTemplateDialog((IEnumerable <ITrackedItemType>) this.FilteredItemTypes, this.services); selectTemplateDialog.SelectedTemplate = this.activeType; bool?nullable = selectTemplateDialog.ShowDialog(); this.activeType = (nullable.HasValue ? (nullable.GetValueOrDefault() ? true : false) : 0) != 0 ? selectTemplateDialog.SelectedTemplate : (ITrackedItemType)null; }
private bool AttemptToDetermineDefaultTemplate() { string workItemTypeFromSuo = this.GetDefaultWorkItemTypeFromSuo(); bool flag = false; foreach (ITrackedItemType trackedItemType in (IEnumerable <ITrackedItemType>) this.FilteredItemTypes) { if (trackedItemType.Name == workItemTypeFromSuo) { flag = true; this.activeType = trackedItemType; break; } } if (!flag) { this.activeType = (ITrackedItemType)null; } return(flag); }
public RegisterItemDialog(IServiceProvider services, ITrackedItemType type, IList <ITrackedItemType> allTypes, string defaultTitle, string defaultDescription, string[] fileAttachments) { this.services = services; this.configuration = ServiceProviderExtensions.GetService <IConfigurationService>(this.services)["SaveTFSWorkItem"]; this.defaultTitle = defaultTitle; this.defaultDescription = defaultDescription; this.fileAttachments = fileAttachments; this.allTypes = allTypes; this.InitializeComponent(); this.DataContext = (object)this; this.Title = StringTable.RegisterTFSItemDialogTitle; this.type = type; this.AcceptButton.Click += new RoutedEventHandler(this.Button_Click); this.CancelButton.Click += new RoutedEventHandler(this.Button_Click); this.ChooseButton.Click += new RoutedEventHandler(this.Button_Click); this.RegenerateForm(type); this.Height = (double)this.configuration.GetProperty("Height", (object)645.0); this.Width = (double)this.configuration.GetProperty("Width", (object)750.0); this.SizeChanged += new SizeChangedEventHandler(this.RegisterItemDialog_SizeChanged); }