// Called by MiddleToolbar public void ChangeMode(DisplayMode mode) { Remove(currView); // Free Memory currView.Destroy(); currView.Dispose(); switch (mode) { case DisplayMode.PROGRAMM: currView = new ProgrammListView(); break; case DisplayMode.KATEGORIE: currView = new CategorieListView(); break; case DisplayMode.TEXTE: currView = new TextsListView(); break; case DisplayMode.VERANSTALTUNG: currView = new EventListView(); break; default: throw new System.NotImplementedException("Invalid DisplayMode"); } Add(currView); currView.ShowAll(); }
public ListViewKeyItem(AbstractListView parent) { ItemsWithSameKey = new List <IKeyValueSource>(); ConflictItems = new HashSet <IKeyValueSource>(); ErrorMessages = new HashSet <string>(); FileRefOk = true; CodeReferences = new List <CodeReferenceResultItem>(); this.AbstractListView = parent; }
public ListViewMakeExternalUndoUnit(AbstractListView listView, List <ListViewKeyItem> items, bool referenceExisting) { if (listView == null) { throw new ArgumentNullException("listView"); } if (items == null) { throw new ArgumentNullException("items"); } this.Items = items; this.ListView = listView; this.ReferenceExisting = referenceExisting; }
public ListViewMakeEmbeddedUndoUnit(AbstractListView listView, List <ListViewKeyItem> items, bool delete) { if (listView == null) { throw new ArgumentNullException("listView"); } if (items == null) { throw new ArgumentNullException("items"); } this.Items = items; this.ListView = listView; this.Deleted = delete; }
public ListViewRenameKeyUndoUnit(ResXEditorControl control, AbstractListView listView, ListViewKeyItem item, string oldKey, string newKey) : base(oldKey, newKey) { if (control == null) { throw new ArgumentNullException("control"); } if (listView == null) { throw new ArgumentNullException("listView"); } if (item == null) { throw new ArgumentNullException("item"); } this.Item = item; this.ListView = listView; this.Control = control; }
private ListFrameAdapter() : base() { currView = new ProgrammListView(); this.Add(currView); }
public override void Undo() { if (Control.Editor.ReadOnly) { throw new Exception("Cannot perform this operation - the document is readonly."); } try { HashSet <AbstractListView> usedLists = new HashSet <AbstractListView>(); // check if files were deleted during the operation bool filesDeleted = false; foreach (var item in Items) { if ((item.RemoveKind & REMOVEKIND.DELETE_FILE) == REMOVEKIND.DELETE_FILE) { filesDeleted = true; } } if (filesDeleted) { // confirm adding references to non-existing files DialogResult result = VisualLocalizer.Library.Components.MessageBox.Show("Files were erased from disk during this operation. Some items will probably be improperly displayed and project will fail to compile. Proceed anyway?", null, OLEMSGBUTTON.OLEMSGBUTTON_YESNO, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST, OLEMSGICON.OLEMSGICON_WARNING); if (result != DialogResult.Yes) { return; } } foreach (var item in Items.OrderBy((i) => { return(i.IndexAtDeleteTime); })) { // add excluded (but not deleted) files to project if ((item.RemoveKind & REMOVEKIND.EXCLUDE) == REMOVEKIND.EXCLUDE && (item.RemoveKind & REMOVEKIND.DELETE_FILE) != REMOVEKIND.DELETE_FILE && item.NeighborItems != null && item.DataNode.FileRef != null && File.Exists(item.DataNode.FileRef.FileName)) { ProjectItem newItem = item.NeighborItems.AddFromFile(Path.GetFullPath(item.DataNode.FileRef.FileName)); if (newItem.ContainingProject != null && newItem.ContainingProject.Kind.ToUpperInvariant() != StringConstants.WebSiteProject) { newItem.Properties.Item("BuildAction").Value = prjBuildAction.prjBuildActionNone; } } AbstractListView ListView = item.AbstractListView; usedLists.Add(ListView); // add the item back to the list view if (item.IndexAtDeleteTime >= 0 && item.IndexAtDeleteTime < ListView.Items.Count) { ListView.Items.Insert(item.IndexAtDeleteTime, item); } else { ListView.Items.Add(item); } item.BeforeEditKey = null; item.AfterEditKey = item.Text; // update the image for the item if (!string.IsNullOrEmpty(item.ImageKey)) { object bmp = GetImageFor(item); if (bmp != null) { item.FileRefOk = true; if (bmp is Bitmap) { ListView.LargeImageList.Images.Add(item.ImageKey, (Bitmap)bmp); ListView.SmallImageList.Images.Add(item.ImageKey, (Bitmap)bmp); } else { ListView.LargeImageList.Images.Add(item.ImageKey, (Icon)bmp); ListView.SmallImageList.Images.Add(item.ImageKey, (Icon)bmp); } string tmp = item.ImageKey; item.ImageKey = null; item.ImageKey = tmp; } else { item.FileRefOk = false; } } ListView.Validate(item); } // update state of list views foreach (var usedList in usedLists) { usedList.NotifyDataChanged(); usedList.NotifyItemsStateChanged(); } if (Items.Count > 0 && Items[0].AbstractListView != null) { Items[0].AbstractListView.SetContainingTabPageSelected(); } } catch (Exception ex) { VLOutputWindow.VisualLocalizerPane.WriteException(ex); VisualLocalizer.Library.Components.MessageBox.ShowException(ex); } }
public override void Redo() { if (Control.Editor.ReadOnly) { throw new Exception("Cannot perform this operation - the document is readonly."); } try { HashSet <AbstractListView> usedLists = new HashSet <AbstractListView>(); foreach (ListViewKeyItem item in Items) { // re-exclude and re-delete the files if (item.RemoveKind != REMOVEKIND.REMOVE && item.DataNode.FileRef != null && item.NeighborItems != null) { string file = item.DataNode.FileRef.FileName; ProjectItem projItem = VisualLocalizerPackage.Instance.DTE.Solution.FindProjectItem(file); if (projItem != null) { if ((item.RemoveKind & REMOVEKIND.EXCLUDE) == REMOVEKIND.EXCLUDE) { projItem.Remove(); } else { projItem.Delete(); File.Delete(file); } } } AbstractListView ListView = item.AbstractListView; usedLists.Add(ListView); // unregister the item from the conflict resolver ConflictResolver.TryAdd(item.Key, null, item, Control.Editor.ProjectItem, null); // remove its image if (!string.IsNullOrEmpty(item.ImageKey) && ListView.LargeImageList.Images.ContainsKey(item.ImageKey)) { ListView.LargeImageList.Images.RemoveByKey(item.ImageKey); ListView.SmallImageList.Images.RemoveByKey(item.ImageKey); } // remove the item from the list ListView.Items.Remove(item); } // update state of list views foreach (var usedList in usedLists) { usedList.NotifyDataChanged(); usedList.NotifyItemsStateChanged(); } if (Items.Count > 0 && Items[0].AbstractListView != null) { Items[0].AbstractListView.SetContainingTabPageSelected(); } } catch (Exception ex) { VLOutputWindow.VisualLocalizerPane.WriteException(ex); VisualLocalizer.Library.Components.MessageBox.ShowException(ex); } }