public frmMain() { InitializeComponent(); PipelineHelper.DefaultInit(); builder = new ContentBuilder(null); builder.BuildStatusChanged += Builder_BuildStatusChanged; builder.ItemProgress += Builder_ItemProgress; builder.BuildMessage += Builder_BuildMessage; treeMap = new Dictionary <ContentItem, TreeNode>(); treeContentFiles.NodeMouseClick += TreeContentFilesOnNodeMouseClick; this.newFolderMenuItem.Click += (o, e) => AddNewFolder.Execute(GetSelectedItem(), CurrentProject.File); this.existingFolderMenuItem.Click += (o, e) => AddExistingFolder.Execute(GetSelectedItem(), CurrentProject.File); this.existingItemMenuItem.Click += (o, e) => AddExistingItem.Execute(GetSelectedItem(), CurrentProject.File); this.deleteMenuItem.Click += (o, e) => DeleteItem.Execute(GetSelectedItem()); this.deleteToolStripMenuItem.Click += (o, e) => DeleteItem.Execute(GetSelectedItem()); this.deleteToolStripMenuItem1.Click += (o, e) => DeleteItem.Execute(GetSelectedItem()); this.renameMenuItem.Click += (o, e) => RenameItem.Execute(GetSelectedItem(), treeMap); this.renameToolStripMenuItem.Click += (o, e) => RenameItem.Execute(GetSelectedItem(), treeMap); this.renameToolStripMenuItem1.Click += (o, e) => RenameItem.Execute(GetSelectedItem(), treeMap); this.buildToolStripMenuItem.Click += (o, e) => BuildItem.Execute(GetSelectedItem(), builder); this.buildToolStripMenuItem1.Click += (o, e) => BuildItem.Execute(GetSelectedItem(), builder); this.buildToolStripMenuItem2.Click += (o, e) => BuildItem.Execute(GetSelectedItem(), builder); }
void Rename() { LV_data data = LV_items.SelectedItem as LV_data; RenameItem rename = new RenameItem(data.Node); rename.Show(); }
public void When(RenameItem c) { NoteItem note; if (_state.TryGet(c.Id, out note)) { if (note.Title != c.Name) { Apply(new NoteRenamed(note.Id, note.Title, c.Name, note.Story)); } return; } TaskItem task; if (_state.TryGet(c.Id, out task)) { if (task.Name != c.Name) { Apply(new TaskRenamed(task.Id, task.Name, c.Name, task.Story)); } return; } SimpleStory story; if (_state.TryGetStory(new StoryId(c.Id), out story)) { if (story.Name != c.Name) { Apply(new SimpleStoryRenamed(new StoryId(c.Id), story.Name, c.Name)); } return; } throw Error("Renaming item {0} is not supported", c.Id); }
void Rename() { LV_data data = LV_items.SelectedItem as LV_data; RenameItem rename = new RenameItem(data.Node); rename.Owner = main_window; rename.ShowDialog(); }
/// <summary> /// Checks for errors before applying a rule. /// </summary> /// <param name="node">The node instance to check.</param> /// <param name="dataList">Optional data collected during inspection of sources.</param> /// <param name="data">Private data to give to Apply() upon return.</param> /// <returns>True if an error occured.</returns> public override bool CheckConsistency(IInheritance node, IDictionary <ISourceTemplate, object> dataList, out object data) { bool Success = true; data = null; IClassType ParentTypeWithRename = null; IClassType ResolvedParent = node.ResolvedClassParentType.Item; ISealableDictionary <string, string> SourceIdentifierTable = new SealableDictionary <string, string>(); // string (source) -> string (destination) ISealableDictionary <string, string> DestinationIdentifierTable = new SealableDictionary <string, string>(); // string (destination) -> string (source) ISealableDictionary <IFeatureName, ISealableDictionary <string, IClass> > RenamedExportTable = ResolvedParent.ExportTable.CloneUnsealed(); ISealableDictionary <IFeatureName, ITypedefType> RenamedTypedefTable = ResolvedParent.TypedefTable.CloneUnsealed(); ISealableDictionary <IFeatureName, IDiscrete> RenamedDiscreteTable = ResolvedParent.DiscreteTable.CloneUnsealed(); ISealableDictionary <IFeatureName, IFeatureInstance> RenamedFeatureTable = new SealableDictionary <IFeatureName, IFeatureInstance>(); foreach (KeyValuePair <IFeatureName, IFeatureInstance> Entry in ResolvedParent.FeatureTable) { IFeatureName AncestorFeatureName = Entry.Key; IFeatureInstance AncestorFeatureInstance = Entry.Value; RenamedFeatureTable.Add(AncestorFeatureName, AncestorFeatureInstance.Clone(ResolvedParent)); } foreach (IRename RenameItem in node.RenameList) { Success &= RenameItem.CheckGenericRename(new IDictionaryIndex <IFeatureName>[] { RenamedExportTable, RenamedTypedefTable, RenamedDiscreteTable, RenamedFeatureTable }, SourceIdentifierTable, DestinationIdentifierTable, (IFeatureName item) => item.Name, (string name) => new FeatureName(name), ErrorList); } if (Success) { Success &= ResolveInstancingAfterRename(node, RenamedExportTable, RenamedTypedefTable, RenamedDiscreteTable, RenamedFeatureTable); if (Success) { IClass EmbeddingClass = node.EmbeddingClass; ParentTypeWithRename = ClassType.Create(ResolvedParent.BaseClass, ResolvedParent.TypeArgumentTable, EmbeddingClass.ResolvedClassType.Item); ParentTypeWithRename.ExportTable.Merge(RenamedExportTable); ParentTypeWithRename.ExportTable.Seal(); ParentTypeWithRename.TypedefTable.Merge(RenamedTypedefTable); ParentTypeWithRename.TypedefTable.Seal(); ParentTypeWithRename.DiscreteTable.Merge(RenamedDiscreteTable); ParentTypeWithRename.DiscreteTable.Seal(); ParentTypeWithRename.FeatureTable.Merge(RenamedFeatureTable); ParentTypeWithRename.FeatureTable.Seal(); } } if (Success) { data = ParentTypeWithRename; } return(Success); }
private async void RenameFile_Click(object sender, RoutedEventArgs e) { if (SecureGridView.SelectedItem is FileSystemStorageItemBase RenameItem) { RenameDialog dialog = new RenameDialog(await RenameItem.GetStorageItem().ConfigureAwait(true)); if ((await dialog.ShowAsync().ConfigureAwait(true)) == ContentDialogResult.Primary) { await(await RenameItem.GetStorageItem().ConfigureAwait(true)).RenameAsync(dialog.DesireName); } } }
/// <summary> /// Check all rename clauses separately. /// </summary> /// <param name="importedClassTable">Table of imported classes.</param> /// <param name="errorList">List of errors found.</param> /// <returns>True if all rename clauses are valid.</returns> public virtual bool CheckRenames(ISealableDictionary <string, IImportedClass> importedClassTable, IErrorList errorList) { ISealableDictionary <string, string> SourceIdentifierTable = new SealableDictionary <string, string>(); // string (source) -> string (destination) ISealableDictionary <string, string> DestinationIdentifierTable = new SealableDictionary <string, string>(); // string (destination) -> string (source) bool Success = true; foreach (IRename RenameItem in RenameList) { Success &= RenameItem.CheckGenericRename(new IDictionaryIndex <string>[] { importedClassTable }, SourceIdentifierTable, DestinationIdentifierTable, (string key) => key, (string s) => s, errorList); } Debug.Assert(Success || !errorList.IsEmpty); return(Success); }
private void linkLabelname_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { var current = observationItemsBindingSource1.Current as ObservationItem; if (current == null) { return; } using (var renameDialog = new RenameItem()) { renameDialog.Item = current; if (renameDialog.ShowDialog(this) == DialogResult.OK) { renameDialog.Apply(); } } }
private void linkLabel1Name1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { var item = runItemsBindingSource1.Current as RunItem; if (item == null) { return; } using (var renameDialog = new RenameItem()) { renameDialog.Item = item; if (renameDialog.ShowDialog(this) == DialogResult.OK) { renameDialog.Apply(); } } }
private async void RenameFile_Click(object sender, RoutedEventArgs e) { if (SecureGridView.SelectedItem is SecureAreaStorageItem RenameItem) { RenameDialog dialog = new RenameDialog(RenameItem); if ((await dialog.ShowAsync().ConfigureAwait(true)) == ContentDialogResult.Primary) { if (await RenameItem.GetStorageItem().ConfigureAwait(true) is IStorageItem Item) { await Item.RenameAsync(dialog.DesireName); await RenameItem.Update().ConfigureAwait(false); } } } }
private void linkLabelNameMaize_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { var item = nonVarietyItemsBindingSource2.Current as CropParameterItem; if (item == null) { return; } using (var renameDialog = new RenameItem()) { renameDialog.Item = item; if (renameDialog.ShowDialog(this) == DialogResult.OK) { renameDialog.Apply(n => n.ParameterItem, (n, s) => n.ParameterItem = s, m => m.ParameterItem, (m, s) => m.ParameterItem = s); } } }
private void linkLabelName_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e) { var item = siteItemsBindingSource1.Current as SiteItem; if (item == null) { return; } using (var renameDialog = new RenameItem()) { renameDialog.Item = item; if (renameDialog.ShowDialog(this) == DialogResult.OK) { renameDialog.Apply(n => n.SiteItem, (n, s) => n.SiteItem = s, m => m.SiteItem, (m, s) => m.SiteItem = s); } } }
private void linkLabelName_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { ManagementItem item = managementItemsBindingSource1.Current as ManagementItem; if (item == null) { return; } using (var renameDialog = new RenameItem()) { renameDialog.Item = item; if (renameDialog.ShowDialog(this) == DialogResult.OK) { renameDialog.Apply(n => n.ManagementItem, (n, s) => n.ManagementItem = s, m => m.ManagementItem, (m, s) => m.ManagementItem = s); } } //update the list after the renaming if (experimentNameBindingSource != null) { updateListBox1((string)experimentNameBindingSource.Current, item.Name); } }