From c05ec6ccc12ca83daeda6415fd3e520c4242ffd5 Mon Sep 17 00:00:00 2001 From: Lehonti Ramos Date: Mon, 4 Sep 2023 17:45:47 +0200 Subject: [PATCH 1/5] Modernized getter syntax --- MindMate/Controller/ContextMenuCtrl.cs | 2 +- MindMate/Controller/MainCtrl.cs | 18 +-- MindMate/Controller/MapCtrl.cs | 4 +- MindMate/MetaModel/MetaModel.cs | 30 +--- MindMate/MetaModel/ModelIcon.cs | 5 +- MindMate/MetaModel/StyleImageGenerator.cs | 9 +- MindMate/Model/AttributeSpec.cs | 10 +- MindMate/Model/ClipboardManager.cs | 16 +-- MindMate/Model/MapNode.Attribute.cs | 11 +- MindMate/Model/MapNode.cs | 133 ++++-------------- MindMate/Model/MapTree.cs | 28 +--- MindMate/Model/SelectedNodes.cs | 12 +- MindMate/Modules/Undo/BatchChange.cs | 8 +- MindMate/Modules/Undo/ChangeManager.cs | 20 +-- MindMate/Modules/Undo/Changes/AttributeAdd.cs | 5 +- .../Modules/Undo/Changes/AttributeDelete.cs | 5 +- .../Modules/Undo/Changes/AttributeSpecAdd.cs | 5 +- .../Undo/Changes/AttributeSpecDataType.cs | 5 +- .../Undo/Changes/AttributeSpecDelete.cs | 5 +- .../Undo/Changes/AttributeSpecListType.cs | 5 +- .../Modules/Undo/Changes/AttributeSpecName.cs | 5 +- .../Modules/Undo/Changes/AttributeSpecType.cs | 5 +- .../Undo/Changes/AttributeSpecValueAdd.cs | 5 +- .../Undo/Changes/AttributeSpecValueRemove.cs | 5 +- .../Undo/Changes/AttributeSpecVisibility.cs | 5 +- .../Modules/Undo/Changes/AttributeUpdate.cs | 5 +- .../Modules/Undo/Changes/BackColorChange.cs | 8 +- MindMate/Modules/Undo/Changes/BoldChange.cs | 8 +- MindMate/Modules/Undo/Changes/ColorChange.cs | 8 +- .../Modules/Undo/Changes/FontNameChange.cs | 8 +- .../Modules/Undo/Changes/FontSizeChange.cs | 8 +- MindMate/Modules/Undo/Changes/IconAdd.cs | 8 +- MindMate/Modules/Undo/Changes/IconRemove.cs | 8 +- .../Undo/Changes/ImageAlignmentChange.cs | 8 +- MindMate/Modules/Undo/Changes/ImageChange.cs | 8 +- .../Modules/Undo/Changes/ImageSizeChange.cs | 8 +- MindMate/Modules/Undo/Changes/ItalicChange.cs | 8 +- MindMate/Modules/Undo/Changes/LabelChange.cs | 8 +- .../Modules/Undo/Changes/LineColorChange.cs | 8 +- .../Modules/Undo/Changes/LinePatternChange.cs | 8 +- .../Modules/Undo/Changes/LineWidthChange.cs | 8 +- MindMate/Modules/Undo/Changes/LinkChange.cs | 8 +- MindMate/Modules/Undo/Changes/MoveDown.cs | 8 +- MindMate/Modules/Undo/Changes/MoveUp.cs | 8 +- MindMate/Modules/Undo/Changes/NodeAttach.cs | 8 +- MindMate/Modules/Undo/Changes/NodeDelete.cs | 8 +- MindMate/Modules/Undo/Changes/NodeDetach.cs | 8 +- MindMate/Modules/Undo/Changes/NodeNew.cs | 8 +- .../Modules/Undo/Changes/NoteTextChange.cs | 8 +- MindMate/Modules/Undo/Changes/ShapeChange.cs | 8 +- .../Modules/Undo/Changes/StrikeoutChange.cs | 8 +- MindMate/Modules/Undo/Changes/TextChange.cs | 8 +- MindMate/Plugins/PluginManager.cs | 10 +- MindMate/Plugins/Tasks/Model/BaseTaskList.cs | 8 +- .../Tasks/Model/CompletedTaskEventArgs.cs | 2 +- .../Tasks/Model/PendingTaskEventArgs.cs | 2 +- MindMate/Plugins/Tasks/Model/TaskList.cs | 8 +- .../Plugins/Tasks/Reminder/ReminderCtrl.cs | 2 +- .../Tasks/Reminder/TaskReminderDialog.cs | 4 +- .../Plugins/Tasks/SideBar/ControlGroup.cs | 15 +- .../Tasks/SideBar/ControlGroupCollection.cs | 17 +-- MindMate/Plugins/Tasks/SideBar/SideBar.cs | 10 +- MindMate/Plugins/Tasks/TaskCompleteIcon.cs | 11 +- MindMate/Plugins/Tasks/TaskDueIcon.cs | 9 +- MindMate/Plugins/Tasks/TaskList/TaskGroup.cs | 22 +-- MindMate/Plugins/Tasks/TaskList/TaskView.cs | 8 +- .../Plugins/Tasks/TaskPlugin.ContextMenu.cs | 10 +- .../Plugins/Tasks/TaskPlugin.SystemIcons.cs | 4 +- MindMate/Plugins/Tasks/TaskPlugin.cs | 4 +- MindMate/Serialization/Dir.cs | 10 +- MindMate/Serialization/PersistenceManager.cs | 10 +- MindMate/Serialization/PersistentTree.cs | 8 +- MindMate/View/Dialogs/AboutBox.cs | 8 +- MindMate/View/Dialogs/IconSelectorExt.cs | 5 +- MindMate/View/EditorTabs/TabBase.cs | 2 +- MindMate/View/MapControls/IconView.cs | 26 +--- MindMate/View/MapControls/Link.cs | 18 +-- MindMate/View/MapControls/MapView.cs | 29 +--- .../View/MapControls/MapViewDragHandler.cs | 22 +-- .../View/MapControls/MapViewFormatPainter.cs | 2 +- MindMate/View/MapControls/NodeView.cs | 53 ++----- MindMate/View/MapControls/NoteIcon.cs | 18 +-- MindMate/View/NoteEditing/ImageLocalPath.cs | 4 +- .../MsHtmlWrap/HtmlImageCreator.cs | 3 +- .../NoteEditing/MsHtmlWrap/HtmlTableHelper.cs | 3 +- .../NoteEditing/MsHtmlWrap/MarkupPointer.cs | 8 +- MindMate/View/NoteEditing/NoteEditor.cs | 10 +- MindMate/View/NoteEditing/NoteMapGlue.cs | 8 +- .../PluggableProtocol/ProtocolBase.cs | 8 +- MindMate/View/SideTabControl.cs | 24 +--- 90 files changed, 206 insertions(+), 793 deletions(-) diff --git a/MindMate/Controller/ContextMenuCtrl.cs b/MindMate/Controller/ContextMenuCtrl.cs index cdc9f3ba..8a72fcf7 100644 --- a/MindMate/Controller/ContextMenuCtrl.cs +++ b/MindMate/Controller/ContextMenuCtrl.cs @@ -19,7 +19,7 @@ namespace MindMate.Controller /// public class ContextMenuCtrl { - private MapCtrl CurrentMapCtrl { get { return mainCtrl.CurrentMapCtrl; } } + private MapCtrl CurrentMapCtrl => mainCtrl.CurrentMapCtrl; private readonly MainCtrl mainCtrl; diff --git a/MindMate/Controller/MainCtrl.cs b/MindMate/Controller/MainCtrl.cs index 5322d74d..73575aa2 100644 --- a/MindMate/Controller/MainCtrl.cs +++ b/MindMate/Controller/MainCtrl.cs @@ -43,18 +43,12 @@ public MapCtrl CurrentMapCtrl } } - public ChangeManager ChangeManager { get { return CurrentMapCtrl.MapView.Tree.ChangeManager; } } + public ChangeManager ChangeManager => CurrentMapCtrl.MapView.Tree.ChangeManager; public WinFormsStatusBarCtrl statusBarCtrl; private NoteEditorCtrl noteCrtl; - public NoteEditorCtrl NoteCrtl - { - get - { - return noteCrtl; - } - } + public NoteEditorCtrl NoteCrtl => noteCrtl; public NodeContextMenu NodeContextMenu { get; private set; } @@ -443,13 +437,7 @@ public void ClearSelectionFormatting() /// /// Selected Nodes of the currently active MapView /// - public SelectedNodes ActiveNodes - { - get - { - return CurrentMapCtrl.MapView.Tree.SelectedNodes; - } - } + public SelectedNodes ActiveNodes => CurrentMapCtrl.MapView.Tree.SelectedNodes; public void StartNoteEditing() { diff --git a/MindMate/Controller/MapCtrl.cs b/MindMate/Controller/MapCtrl.cs index 5d12deae..6ff5d4f6 100644 --- a/MindMate/Controller/MapCtrl.cs +++ b/MindMate/Controller/MapCtrl.cs @@ -33,8 +33,8 @@ public class MapCtrl public MapView MapView; public ContextMenuCtrl ContextMenuCtrl { get; private set; } - - private MapTree tree { get { return MapView.Tree; } } + + private MapTree tree => MapView.Tree; public MapCtrl(MapView mapView, DialogManager dialogs, NodeContextMenu nodeContextMenu) { diff --git a/MindMate/MetaModel/MetaModel.cs b/MindMate/MetaModel/MetaModel.cs index c7781929..e63e2a22 100644 --- a/MindMate/MetaModel/MetaModel.cs +++ b/MindMate/MetaModel/MetaModel.cs @@ -39,29 +39,17 @@ public static void Initialize() private static MetaModel instance; - public static MetaModel Instance - { - get - { - return instance; - } - } + public static MetaModel Instance => instance; #endregion private readonly List iconsList = new List(); //[ProtoBuf.ProtoMember(1)] - public List IconsList - { - get { return iconsList; } - } + public List IconsList => iconsList; private readonly List systemIconList = new List(); - public List SystemIconList - { - get { return systemIconList; } - } + public List SystemIconList => systemIconList; //[ProtoBuf.ProtoMember(2)] public string LastOpenedFile { get; set; } @@ -70,12 +58,7 @@ public List SystemIconList private readonly CustomFontDialog.RecentlyUsedList recentFiles = new CustomFontDialog.RecentlyUsedList(RecentFilesCount); //[ProtoBuf.ProtoMember(3)] - public CustomFontDialog.RecentlyUsedList RecentFiles { - get - { - return recentFiles; - } - } + public CustomFontDialog.RecentlyUsedList RecentFiles => recentFiles; public System.Drawing.Color MapEditorBackColor { get; set; } @@ -97,10 +80,7 @@ public CustomFontDialog.RecentlyUsedList RecentFiles { private readonly List nodeStyles = new List(); - public List NodeStyles - { - get { return nodeStyles; } - } + public List NodeStyles => nodeStyles; public ThemeManager Themes { get; } = new ThemeManager(); diff --git a/MindMate/MetaModel/ModelIcon.cs b/MindMate/MetaModel/ModelIcon.cs index 2b19a835..73a31249 100644 --- a/MindMate/MetaModel/ModelIcon.cs +++ b/MindMate/MetaModel/ModelIcon.cs @@ -63,9 +63,6 @@ public string Shortcut private Bitmap bitmap; - public Bitmap Bitmap - { - get { return bitmap; } - } + public Bitmap Bitmap => bitmap; } } diff --git a/MindMate/MetaModel/StyleImageGenerator.cs b/MindMate/MetaModel/StyleImageGenerator.cs index d6e72ec7..f6c3ddc8 100644 --- a/MindMate/MetaModel/StyleImageGenerator.cs +++ b/MindMate/MetaModel/StyleImageGenerator.cs @@ -49,13 +49,8 @@ public NodeView GetNodeView(MapNode node) return mapNode.NodeView; } - public MapTree Tree { - get { return mapNode.Tree; } - } + public MapTree Tree => mapNode.Tree; - public MapNode HighlightedNode - { - get { return null; } - } + public MapNode HighlightedNode => null; } } diff --git a/MindMate/Model/AttributeSpec.cs b/MindMate/Model/AttributeSpec.cs index d54dec41..0c54fe32 100644 --- a/MindMate/Model/AttributeSpec.cs +++ b/MindMate/Model/AttributeSpec.cs @@ -110,12 +110,12 @@ public AttributeListOption ListType /// private readonly SortedSet values; - /// - /// List of values are maintained if AttributeListOption is RestrictedList or OptionalList - /// - public IEnumerable Values { get { return values; } } + /// + /// List of values are maintained if AttributeListOption is RestrictedList or OptionalList + /// + public IEnumerable Values => values; - public int GetValuesCount() { return values != null? 0 : values.Count; } + public int GetValuesCount() { return values != null? 0 : values.Count; } public void AddValue(string value) { diff --git a/MindMate/Model/ClipboardManager.cs b/MindMate/Model/ClipboardManager.cs index 8cb135ed..99f8aa8b 100644 --- a/MindMate/Model/ClipboardManager.cs +++ b/MindMate/Model/ClipboardManager.cs @@ -22,24 +22,12 @@ public static class ClipboardManager /// /// Clipboard contains cut node (detached node) /// - public static bool HasCutNode - { - get - { - return internalClipboard.Count > 0 && hasCutNode; - } - } + public static bool HasCutNode => internalClipboard.Count > 0 && hasCutNode; - public static bool CanPaste - { - get - { - return Clipboard.ContainsData(MindMateClipboardFormat) || + public static bool CanPaste => Clipboard.ContainsData(MindMateClipboardFormat) || Clipboard.ContainsText() || Clipboard.ContainsFileDropList() || Clipboard.ContainsImage(); - } - } public static void Copy(SelectedNodes nodes) { diff --git a/MindMate/Model/MapNode.Attribute.cs b/MindMate/Model/MapNode.Attribute.cs index db55178a..ce414cca 100644 --- a/MindMate/Model/MapNode.Attribute.cs +++ b/MindMate/Model/MapNode.Attribute.cs @@ -22,7 +22,7 @@ public Attribute(MapTree.AttributeSpec aspec, object val) public static Attribute Empty = new Attribute(null, null); public bool IsEmpty() { return AttributeSpec == null; } - public string ValueString { get { return Value?.ToString(); } } + public string ValueString => Value?.ToString(); public override string ToString() { return (AttributeSpec != null ? AttributeSpec.Name : "") + " : " + (ValueString ?? ""); @@ -35,14 +35,11 @@ public override string ToString() /// returns null if no attributes /// [Serialized(Order = 25)] - public IEnumerable Attributes { get { return attributeList; } } + public IEnumerable Attributes => attributeList; - public bool HasAttributes - { - get { return attributeList != null && attributeList.Count > 0; } - } + public bool HasAttributes => attributeList != null && attributeList.Count > 0; - public int AttributeCount { get { return attributeList == null ? 0 : attributeList.Count; } } + public int AttributeCount => attributeList == null ? 0 : attributeList.Count; public Attribute GetAttribute(int index) { return attributeList[index]; } diff --git a/MindMate/Model/MapNode.cs b/MindMate/Model/MapNode.cs index 19b444e7..93df03ea 100644 --- a/MindMate/Model/MapNode.cs +++ b/MindMate/Model/MapNode.cs @@ -26,22 +26,13 @@ public partial class MapNode /// [Serialized(Order = 3)] public string Id { get; private set; } - public bool HasId { get { return Id != null; } } + public bool HasId => Id != null; private NodePosition pos; [Serialized(Order = 2)] - public NodePosition Pos - { - get - { - return pos; - } - } - public bool HasPos - { - get { return Parent != null && Pos != Parent.Pos; } - } + public NodePosition Pos => pos; + public bool HasPos => Parent != null && Pos != Parent.Pos; private string text; [Serialized(Order = 1)] @@ -59,10 +50,7 @@ public string Text Tree.FireEvent(this, NodeProperties.Text, oldValue); } } - public bool HasText - { - get { return text != null; } - } + public bool HasText => text != null; private bool folded; [Serialized(Order = 4)] @@ -88,10 +76,7 @@ public bool Folded Tree.FireEvent(this, NodeProperties.Folded, !folded); } } - public bool HasFolded - { - get { return folded; } - } + public bool HasFolded => folded; private string link; [Serialized(Order = 5)] @@ -109,10 +94,7 @@ public string Link Tree.FireEvent(this, NodeProperties.Link, oldValue); } } - public bool HasLink - { - get { return link != null; } - } + public bool HasLink => link != null; [Serialized(Order = 6)] public DateTime Created { get; set; } @@ -147,10 +129,7 @@ public bool Bold Tree.FireEvent(this, NodeProperties.Bold, !bold); } } - public bool HasBold - { - get { return bold; } - } + public bool HasBold => bold; private bool italic; [Serialized(Order = 9)] @@ -168,10 +147,7 @@ public bool Italic Tree.FireEvent(this, NodeProperties.Italic, !italic); } } - public bool HasItalic - { - get { return italic; } - } + public bool HasItalic => italic; private bool strikeout; [Serialized(Order = 10)] @@ -186,10 +162,7 @@ public bool Strikeout Tree.FireEvent(this, NodeProperties.Strikeout, !strikeout); } } - public bool HasStrikeout - { - get { return strikeout; } - } + public bool HasStrikeout => strikeout; private string fontName; [Serialized(Order = 11)] @@ -206,10 +179,7 @@ public string FontName { Tree.FireEvent(this, NodeProperties.FontName, oldValue); } } - public bool HasFontName - { - get { return fontName != null; } - } + public bool HasFontName => fontName != null; private float fontSize; /// @@ -230,10 +200,7 @@ public float FontSize Tree.FireEvent(this, NodeProperties.FontSize, oldValue); } } - public bool HasFontSize - { - get { return fontSize != 0; } - } + public bool HasFontSize => fontSize != 0; private Color backColor; /// @@ -254,10 +221,7 @@ public Color BackColor Tree.FireEvent(this, NodeProperties.BackColor, oldValue); } } - public bool HasBackColor - { - get { return !backColor.IsEmpty; } - } + public bool HasBackColor => !backColor.IsEmpty; private Color color; /// @@ -278,10 +242,7 @@ public Color Color Tree.FireEvent(this, NodeProperties.Color, oldValue); } } - public bool HasColor - { - get { return !color.IsEmpty; } - } + public bool HasColor => !color.IsEmpty; private NodeShape shape; [Serialized(Order = 15)] @@ -299,10 +260,7 @@ public NodeShape Shape Tree.FireEvent(this, NodeProperties.Shape, oldValue); } } - public bool HasShape - { - get { return shape != NodeShape.None; } - } + public bool HasShape => shape != NodeShape.None; private int lineWidth; /// @@ -323,10 +281,7 @@ public int LineWidth Tree.FireEvent(this, NodeProperties.LineWidth, oldValue); } } - public bool HasLineWidth - { - get { return lineWidth != 0; } - } + public bool HasLineWidth => lineWidth != 0; private System.Drawing.Drawing2D.DashStyle linePattern = System.Drawing.Drawing2D.DashStyle.Custom; /// @@ -347,10 +302,7 @@ public System.Drawing.Drawing2D.DashStyle LinePattern Tree.FireEvent(this, NodeProperties.LinePattern, oldValue); } } - public bool HasLinePattern - { - get { return linePattern != DashStyle.Custom; } - } + public bool HasLinePattern => linePattern != DashStyle.Custom; private Color lineColor; [Serialized(Order = 18)] @@ -368,10 +320,7 @@ public Color LineColor Tree.FireEvent(this, NodeProperties.LineColor, oldValue); } } - public bool HasLineColor - { - get { return !lineColor.IsEmpty; } - } + public bool HasLineColor => !lineColor.IsEmpty; private string noteText; [Serialized(Order = 19)] @@ -389,10 +338,7 @@ public string NoteText Tree.FireEvent(this, NodeProperties.NoteText, oldValue); } } - public bool HasNoteText - { - get { return noteText != null; } - } + public bool HasNoteText => noteText != null; [Serialized(Order = 20)] public string Image @@ -407,11 +353,8 @@ public string Image Tree.FireEvent(this, NodeProperties.Image, oldValue); } } - public bool HasImage - { - get { return props?.Image != null; } - } - + public bool HasImage => props?.Image != null; + /// /// Alignment of text in relation to image. /// This property is only applicable if node has an image. @@ -429,12 +372,9 @@ public ImageAlignment ImageAlignment Tree.FireEvent(this, NodeProperties.ImageAlignment, oldValue); } } - public bool HasImageAlignment - { - get { return props != null && props.ImageAlignment != ImageAlignment.Default; } - } - - [Serialized(Order =22)] + public bool HasImageAlignment => props != null && props.ImageAlignment != ImageAlignment.Default; + + [Serialized(Order =22)] public Size ImageSize { get { return props == null ? Size.Empty : props.ImageSize; } @@ -447,10 +387,7 @@ public Size ImageSize Tree.FireEvent(this, NodeProperties.ImageSize, oldValue); } } - public bool HasImageSize - { - get { return props != null && !props.ImageSize.IsEmpty; } - } + public bool HasImageSize => props != null && !props.ImageSize.IsEmpty; private string label; [Serialized(Order = 23)] @@ -465,17 +402,11 @@ public string Label Tree.FireEvent(this,NodeProperties.Label, oldValue); } } - public bool HasLabel - { - get { return label != null; } - } + public bool HasLabel => label != null; [Serialized(Order = 24)] public IconList Icons { get; private set; } - public bool HasIcons - { - get { return Icons != null && Icons.Count > 0; } - } + public bool HasIcons => Icons != null && Icons.Count > 0; private AdvancedProperties props; private void InitializeProps() @@ -503,8 +434,8 @@ private void InitializeProps() #region Supporting Properties (without attributes) - public bool HasChildren { get { return FirstChild != null; } } - + public bool HasChildren => FirstChild != null; + #endregion #region Constructors @@ -688,16 +619,10 @@ public void Detach() /// No operation should be performed on detached node or its decendents except restoring them. /// Descendents of a detached node are still return Detached as false. /// - public bool Detached - { - get - { - return (Previous != null && Previous.Next != this) || + public bool Detached => (Previous != null && Previous.Next != this) || (Next != null && Next.Previous != this) || (Parent != null && !Parent.ChildNodes.Contains(this)) || (Parent == null && Pos != NodePosition.Root); - } - } /// /// Create a detached node. Detached node represents deleted/cut/copied nodes. They should not be modified in any way, should only be restored. diff --git a/MindMate/Model/MapTree.cs b/MindMate/Model/MapTree.cs index 69dd2840..e6c992d4 100644 --- a/MindMate/Model/MapTree.cs +++ b/MindMate/Model/MapTree.cs @@ -36,13 +36,7 @@ public MapNode RootNode #region Selected Nodes private readonly SelectedNodes selectedNodes; - public SelectedNodes SelectedNodes - { - get - { - return selectedNodes; - } - } + public SelectedNodes SelectedNodes => selectedNodes; /// /// Select all visible nodes @@ -91,10 +85,7 @@ public void SelectLevel(int level, bool expandSelection, bool expandNodes) private readonly Dictionary attributeSpecs = new Dictionary(); - public IEnumerable AttributeSpecs - { - get { return attributeSpecs.Values; } - } + public IEnumerable AttributeSpecs => attributeSpecs.Values; /// /// Returns null if AttributeSpec doesn't exist @@ -110,7 +101,7 @@ public AttributeSpec GetAttributeSpec(string attributeName) return null; } - public int AttributeSpecCount { get { return attributeSpecs.Count; } } + public int AttributeSpecCount => attributeSpecs.Count; public event Action AttributeSpecChangeEvent = delegate { }; @@ -280,10 +271,7 @@ public ChangeManager ChangeManager private set; } - public bool ChangeManagerOn - { - get { return ChangeManager != null; } - } + public bool ChangeManagerOn => ChangeManager != null; /// /// Change Manager is off by default (helps in deserialization). @@ -350,13 +338,7 @@ public virtual bool RemoveLargeObject(string key) /// /// Iterate over all nodes in the tree /// - public IEnumerable MapNodes - { - get - { - return (new[] { RootNode }).Concat(RootNode.Descendents); - } - } + public IEnumerable MapNodes => (new[] { RootNode }).Concat(RootNode.Descendents); #region Default Node Formatting / Theme diff --git a/MindMate/Model/SelectedNodes.cs b/MindMate/Model/SelectedNodes.cs index 684851f9..7b99a6e2 100644 --- a/MindMate/Model/SelectedNodes.cs +++ b/MindMate/Model/SelectedNodes.cs @@ -55,17 +55,11 @@ public MapNode Last } } - public int Count - { - get - { - return selectedNodes.Count; - } - } + public int Count => selectedNodes.Count; - public bool IsEmpty { get { return Count == 0; } } + public bool IsEmpty => Count == 0; - public bool IsMultiple { get { return Count > 1; } } + public bool IsMultiple => Count > 1; public MapNode this [int index] { diff --git a/MindMate/Modules/Undo/BatchChange.cs b/MindMate/Modules/Undo/BatchChange.cs index 6363a48c..575c3416 100644 --- a/MindMate/Modules/Undo/BatchChange.cs +++ b/MindMate/Modules/Undo/BatchChange.cs @@ -17,13 +17,7 @@ public BatchChange(string changeDescription, ChangeManager changeManager) private readonly List changes = new List(); - public IList Changes - { - get - { - return changes; - } - } + public IList Changes => changes; public string Description { diff --git a/MindMate/Modules/Undo/ChangeManager.cs b/MindMate/Modules/Undo/ChangeManager.cs index 7f7d64c4..7aab27f2 100644 --- a/MindMate/Modules/Undo/ChangeManager.cs +++ b/MindMate/Modules/Undo/ChangeManager.cs @@ -43,17 +43,13 @@ public void Redo() state = State.None; } - public bool CanUndo { get { return undoStack.Count > 0; } } + public bool CanUndo => undoStack.Count > 0; - public bool CanRedo { get { return redoStack.Count > 0; } } + public bool CanRedo => redoStack.Count > 0; - public int UndoStackCount { - get { return undoStack.Count; } - } + public int UndoStackCount => undoStack.Count; - public int RedoStackCount { - get { return redoStack.Count; } - } + public int RedoStackCount => redoStack.Count; public void RegisterMap(MapTree tree) { @@ -142,13 +138,7 @@ private void Tree_TreeFormatChanged(MapTree tree, TreeDefaultFormatChangedEventA /// Are batch changes in progress. /// While batch is open, all changes are added to the batch till EndBatch is called. /// - public bool IsBatchOpen - { - get - { - return batch != null; - } - } + public bool IsBatchOpen => batch != null; public IDisposable StartBatch(string changeDescription) { diff --git a/MindMate/Modules/Undo/Changes/AttributeAdd.cs b/MindMate/Modules/Undo/Changes/AttributeAdd.cs index 7cb65040..aa067242 100644 --- a/MindMate/Modules/Undo/Changes/AttributeAdd.cs +++ b/MindMate/Modules/Undo/Changes/AttributeAdd.cs @@ -17,10 +17,7 @@ public AttributeAdd(MapNode node, MapNode.Attribute attribute) this.attribute = attribute; } - public string Description - { - get { return "Add Attribute"; } - } + public string Description => "Add Attribute"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/AttributeDelete.cs b/MindMate/Modules/Undo/Changes/AttributeDelete.cs index bd54a9aa..e765f91b 100644 --- a/MindMate/Modules/Undo/Changes/AttributeDelete.cs +++ b/MindMate/Modules/Undo/Changes/AttributeDelete.cs @@ -17,10 +17,7 @@ public AttributeDelete(MapNode node, MapNode.Attribute attribute) this.attribute = attribute; } - public string Description - { - get { return "Delete Attribute"; } - } + public string Description => "Delete Attribute"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/AttributeSpecAdd.cs b/MindMate/Modules/Undo/Changes/AttributeSpecAdd.cs index 9a478ff5..c6fba473 100644 --- a/MindMate/Modules/Undo/Changes/AttributeSpecAdd.cs +++ b/MindMate/Modules/Undo/Changes/AttributeSpecAdd.cs @@ -15,10 +15,7 @@ public AttributeSpecAdd(MapTree.AttributeSpec spec) this.spec = spec; } - public string Description - { - get { return "Attribute Spec Added"; } - } + public string Description => "Attribute Spec Added"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/AttributeSpecDataType.cs b/MindMate/Modules/Undo/Changes/AttributeSpecDataType.cs index 4076a080..9e422c02 100644 --- a/MindMate/Modules/Undo/Changes/AttributeSpecDataType.cs +++ b/MindMate/Modules/Undo/Changes/AttributeSpecDataType.cs @@ -17,10 +17,7 @@ public AttributeSpecDataType(MapTree.AttributeSpec spec, MapTree.AttributeDataTy this.oldValue = oldValue; } - public string Description - { - get { return "Attribute Spec DataType"; } - } + public string Description => "Attribute Spec DataType"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/AttributeSpecDelete.cs b/MindMate/Modules/Undo/Changes/AttributeSpecDelete.cs index 903b106b..53b7bcf6 100644 --- a/MindMate/Modules/Undo/Changes/AttributeSpecDelete.cs +++ b/MindMate/Modules/Undo/Changes/AttributeSpecDelete.cs @@ -15,10 +15,7 @@ public AttributeSpecDelete(MapTree.AttributeSpec spec) this.spec = spec; } - public string Description - { - get { return "Attribute Spec Delete"; } - } + public string Description => "Attribute Spec Delete"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/AttributeSpecListType.cs b/MindMate/Modules/Undo/Changes/AttributeSpecListType.cs index 9f8ff5a0..e92a0214 100644 --- a/MindMate/Modules/Undo/Changes/AttributeSpecListType.cs +++ b/MindMate/Modules/Undo/Changes/AttributeSpecListType.cs @@ -17,10 +17,7 @@ public AttributeSpecListType(MapTree.AttributeSpec spec, MapTree.AttributeListOp this.oldValue = oldValue; } - public string Description - { - get { return "Attribute Spec ListOption Change"; } - } + public string Description => "Attribute Spec ListOption Change"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/AttributeSpecName.cs b/MindMate/Modules/Undo/Changes/AttributeSpecName.cs index 79267ab1..b6e867f2 100644 --- a/MindMate/Modules/Undo/Changes/AttributeSpecName.cs +++ b/MindMate/Modules/Undo/Changes/AttributeSpecName.cs @@ -17,10 +17,7 @@ public AttributeSpecName(MapTree.AttributeSpec spec, string oldValue) this.oldValue = oldValue; } - public string Description - { - get { return "Attribute Spec Name"; } - } + public string Description => "Attribute Spec Name"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/AttributeSpecType.cs b/MindMate/Modules/Undo/Changes/AttributeSpecType.cs index 1ed34f2f..693bd6fe 100644 --- a/MindMate/Modules/Undo/Changes/AttributeSpecType.cs +++ b/MindMate/Modules/Undo/Changes/AttributeSpecType.cs @@ -17,10 +17,7 @@ public AttributeSpecType(MapTree.AttributeSpec spec, MapTree.AttributeType oldVa this.oldValue = oldValue; } - public string Description - { - get { return "Attribute Spec Type"; } - } + public string Description => "Attribute Spec Type"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/AttributeSpecValueAdd.cs b/MindMate/Modules/Undo/Changes/AttributeSpecValueAdd.cs index 5c35a0ac..eb8a5c46 100644 --- a/MindMate/Modules/Undo/Changes/AttributeSpecValueAdd.cs +++ b/MindMate/Modules/Undo/Changes/AttributeSpecValueAdd.cs @@ -17,10 +17,7 @@ public AttributeSpecValueAdd(MapTree.AttributeSpec spec, string value) this.value = value; } - public string Description - { - get { return "Attribute Spec Value Add"; } - } + public string Description => "Attribute Spec Value Add"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/AttributeSpecValueRemove.cs b/MindMate/Modules/Undo/Changes/AttributeSpecValueRemove.cs index 0d0f2de0..1dda5a0f 100644 --- a/MindMate/Modules/Undo/Changes/AttributeSpecValueRemove.cs +++ b/MindMate/Modules/Undo/Changes/AttributeSpecValueRemove.cs @@ -17,10 +17,7 @@ public AttributeSpecValueRemove(MapTree.AttributeSpec spec, string value) this.value = value; } - public string Description - { - get { return "Attribute Spec Value Remove"; } - } + public string Description => "Attribute Spec Value Remove"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/AttributeSpecVisibility.cs b/MindMate/Modules/Undo/Changes/AttributeSpecVisibility.cs index c66c8bb9..03effbf9 100644 --- a/MindMate/Modules/Undo/Changes/AttributeSpecVisibility.cs +++ b/MindMate/Modules/Undo/Changes/AttributeSpecVisibility.cs @@ -17,10 +17,7 @@ public AttributeSpecVisibility(MapTree.AttributeSpec spec, bool oldValue) this.oldValue = oldValue; } - public string Description - { - get { return "Attribute Spec Visibility"; } - } + public string Description => "Attribute Spec Visibility"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/AttributeUpdate.cs b/MindMate/Modules/Undo/Changes/AttributeUpdate.cs index aad81aca..b80bb1af 100644 --- a/MindMate/Modules/Undo/Changes/AttributeUpdate.cs +++ b/MindMate/Modules/Undo/Changes/AttributeUpdate.cs @@ -17,10 +17,7 @@ public AttributeUpdate(MapNode node, MapNode.Attribute oldAttribute) this.attribute = oldAttribute; } - public string Description - { - get { return "Update Attribute"; } - } + public string Description => "Update Attribute"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/BackColorChange.cs b/MindMate/Modules/Undo/Changes/BackColorChange.cs index 3923ce98..35c3193d 100644 --- a/MindMate/Modules/Undo/Changes/BackColorChange.cs +++ b/MindMate/Modules/Undo/Changes/BackColorChange.cs @@ -18,13 +18,7 @@ public BackColorChange(MapNode node, Color oldValue) this.OldColor = oldValue; } - public string Description - { - get - { - return "Back Color Change"; - } - } + public string Description => "Back Color Change"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/BoldChange.cs b/MindMate/Modules/Undo/Changes/BoldChange.cs index 1ce5d1a4..3fe8276f 100644 --- a/MindMate/Modules/Undo/Changes/BoldChange.cs +++ b/MindMate/Modules/Undo/Changes/BoldChange.cs @@ -17,13 +17,7 @@ public BoldChange(MapNode node, bool oldValue) this.oldValue = oldValue; } - public string Description - { - get - { - return "Toggle Bold"; - } - } + public string Description => "Toggle Bold"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/ColorChange.cs b/MindMate/Modules/Undo/Changes/ColorChange.cs index 7194e758..4c5f3436 100644 --- a/MindMate/Modules/Undo/Changes/ColorChange.cs +++ b/MindMate/Modules/Undo/Changes/ColorChange.cs @@ -18,13 +18,7 @@ public ColorChange(MapNode node, Color oldValue) this.OldColor = oldValue; } - public string Description - { - get - { - return "Text Color Change"; - } - } + public string Description => "Text Color Change"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/FontNameChange.cs b/MindMate/Modules/Undo/Changes/FontNameChange.cs index 77bce3f3..e4415311 100644 --- a/MindMate/Modules/Undo/Changes/FontNameChange.cs +++ b/MindMate/Modules/Undo/Changes/FontNameChange.cs @@ -17,13 +17,7 @@ public FontNameChange(MapNode node, string oldValue) this.oldValue = oldValue; } - public string Description - { - get - { - return "Font Name Change"; - } - } + public string Description => "Font Name Change"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/FontSizeChange.cs b/MindMate/Modules/Undo/Changes/FontSizeChange.cs index 422e8241..48967e3c 100644 --- a/MindMate/Modules/Undo/Changes/FontSizeChange.cs +++ b/MindMate/Modules/Undo/Changes/FontSizeChange.cs @@ -17,13 +17,7 @@ public FontSizeChange(MapNode node, float oldValue) this.OldValue = oldValue; } - public string Description - { - get - { - return "Font Size Change"; - } - } + public string Description => "Font Size Change"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/IconAdd.cs b/MindMate/Modules/Undo/Changes/IconAdd.cs index 7d5d5b52..c29840d9 100644 --- a/MindMate/Modules/Undo/Changes/IconAdd.cs +++ b/MindMate/Modules/Undo/Changes/IconAdd.cs @@ -17,13 +17,7 @@ public IconAdd(MapNode node, string icon) this.icon = icon; } - public string Description - { - get - { - return "Icon Added"; - } - } + public string Description => "Icon Added"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/IconRemove.cs b/MindMate/Modules/Undo/Changes/IconRemove.cs index 24c911b4..e845ee4c 100644 --- a/MindMate/Modules/Undo/Changes/IconRemove.cs +++ b/MindMate/Modules/Undo/Changes/IconRemove.cs @@ -17,13 +17,7 @@ public IconRemove(MapNode node, string icon) this.icon = icon; } - public string Description - { - get - { - return "Icon Removed"; - } - } + public string Description => "Icon Removed"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/ImageAlignmentChange.cs b/MindMate/Modules/Undo/Changes/ImageAlignmentChange.cs index 655b97c0..9ac13123 100644 --- a/MindMate/Modules/Undo/Changes/ImageAlignmentChange.cs +++ b/MindMate/Modules/Undo/Changes/ImageAlignmentChange.cs @@ -18,13 +18,7 @@ public ImageAlignmentChange(MapNode node, ImageAlignment oldValue) this.oldValue = oldValue; } - public string Description - { - get - { - return "Image Alignment Changed"; - } - } + public string Description => "Image Alignment Changed"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/ImageChange.cs b/MindMate/Modules/Undo/Changes/ImageChange.cs index da7e20c7..c6fb245b 100644 --- a/MindMate/Modules/Undo/Changes/ImageChange.cs +++ b/MindMate/Modules/Undo/Changes/ImageChange.cs @@ -18,13 +18,7 @@ public ImageChange(MapNode node, string oldValue) this.oldValue = oldValue; } - public string Description - { - get - { - return "Image Changed"; - } - } + public string Description => "Image Changed"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/ImageSizeChange.cs b/MindMate/Modules/Undo/Changes/ImageSizeChange.cs index ffcfd391..a5ee319a 100644 --- a/MindMate/Modules/Undo/Changes/ImageSizeChange.cs +++ b/MindMate/Modules/Undo/Changes/ImageSizeChange.cs @@ -18,13 +18,7 @@ public ImageSizeChange(MapNode node, Size oldValue) this.oldValue = oldValue; } - public string Description - { - get - { - return "Image Size Changed"; - } - } + public string Description => "Image Size Changed"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/ItalicChange.cs b/MindMate/Modules/Undo/Changes/ItalicChange.cs index cfa8735b..552fb8df 100644 --- a/MindMate/Modules/Undo/Changes/ItalicChange.cs +++ b/MindMate/Modules/Undo/Changes/ItalicChange.cs @@ -17,13 +17,7 @@ public ItalicChange(MapNode node, bool oldValue) this.oldValue = oldValue; } - public string Description - { - get - { - return "Toggle Italic"; - } - } + public string Description => "Toggle Italic"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/LabelChange.cs b/MindMate/Modules/Undo/Changes/LabelChange.cs index 053ebc0e..0646716c 100644 --- a/MindMate/Modules/Undo/Changes/LabelChange.cs +++ b/MindMate/Modules/Undo/Changes/LabelChange.cs @@ -17,13 +17,7 @@ public LabelChange(MapNode node, string oldValue) this.oldText = oldValue; } - public string Description - { - get - { - return "Label Change"; - } - } + public string Description => "Label Change"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/LineColorChange.cs b/MindMate/Modules/Undo/Changes/LineColorChange.cs index ce51125f..39674348 100644 --- a/MindMate/Modules/Undo/Changes/LineColorChange.cs +++ b/MindMate/Modules/Undo/Changes/LineColorChange.cs @@ -17,13 +17,7 @@ public LineColorChange(MapNode node, System.Drawing.Color oldValue) this.oldValue = oldValue; } - public string Description - { - get - { - return "Line Color Change"; - } - } + public string Description => "Line Color Change"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/LinePatternChange.cs b/MindMate/Modules/Undo/Changes/LinePatternChange.cs index fd006dfd..787e0c86 100644 --- a/MindMate/Modules/Undo/Changes/LinePatternChange.cs +++ b/MindMate/Modules/Undo/Changes/LinePatternChange.cs @@ -17,13 +17,7 @@ public LinePatternChange(MapNode node, System.Drawing.Drawing2D.DashStyle oldVal this.oldValue = oldValue; } - public string Description - { - get - { - return "Line Pattern Change"; - } - } + public string Description => "Line Pattern Change"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/LineWidthChange.cs b/MindMate/Modules/Undo/Changes/LineWidthChange.cs index c759f795..3ba93ac8 100644 --- a/MindMate/Modules/Undo/Changes/LineWidthChange.cs +++ b/MindMate/Modules/Undo/Changes/LineWidthChange.cs @@ -17,13 +17,7 @@ public LineWidthChange(MapNode node, int oldValue) this.oldValue = oldValue; } - public string Description - { - get - { - return "Line Width Change"; - } - } + public string Description => "Line Width Change"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/LinkChange.cs b/MindMate/Modules/Undo/Changes/LinkChange.cs index bf7a3529..89601513 100644 --- a/MindMate/Modules/Undo/Changes/LinkChange.cs +++ b/MindMate/Modules/Undo/Changes/LinkChange.cs @@ -17,13 +17,7 @@ public LinkChange(MapNode node, string oldValue) this.oldValue = oldValue; } - public string Description - { - get - { - return "Link Changed"; - } - } + public string Description => "Link Changed"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/MoveDown.cs b/MindMate/Modules/Undo/Changes/MoveDown.cs index 894f4efb..c696f8cd 100644 --- a/MindMate/Modules/Undo/Changes/MoveDown.cs +++ b/MindMate/Modules/Undo/Changes/MoveDown.cs @@ -15,13 +15,7 @@ public MoveDown(MapNode node) this.node = node; } - public string Description - { - get - { - return "Node Move Down"; - } - } + public string Description => "Node Move Down"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/MoveUp.cs b/MindMate/Modules/Undo/Changes/MoveUp.cs index a613b0b7..89f87df3 100644 --- a/MindMate/Modules/Undo/Changes/MoveUp.cs +++ b/MindMate/Modules/Undo/Changes/MoveUp.cs @@ -15,13 +15,7 @@ public MoveUp(MapNode node) this.node = node; } - public string Description - { - get - { - return "Node Move Up"; - } - } + public string Description => "Node Move Up"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/NodeAttach.cs b/MindMate/Modules/Undo/Changes/NodeAttach.cs index 7611c630..1a972477 100644 --- a/MindMate/Modules/Undo/Changes/NodeAttach.cs +++ b/MindMate/Modules/Undo/Changes/NodeAttach.cs @@ -15,13 +15,7 @@ public NodeAttach(MapNode node) this.node = node; } - public string Description - { - get - { - return "Attach Node"; - } - } + public string Description => "Attach Node"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/NodeDelete.cs b/MindMate/Modules/Undo/Changes/NodeDelete.cs index 8c3eda8b..b5407c1b 100644 --- a/MindMate/Modules/Undo/Changes/NodeDelete.cs +++ b/MindMate/Modules/Undo/Changes/NodeDelete.cs @@ -15,13 +15,7 @@ public NodeDelete(MapNode node) this.node = node; } - public string Description - { - get - { - return "Node deleted"; - } - } + public string Description => "Node deleted"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/NodeDetach.cs b/MindMate/Modules/Undo/Changes/NodeDetach.cs index 1d32e280..c10ca143 100644 --- a/MindMate/Modules/Undo/Changes/NodeDetach.cs +++ b/MindMate/Modules/Undo/Changes/NodeDetach.cs @@ -21,13 +21,7 @@ public NodeDetach(MapNode node) this.position = node.Pos; } - public string Description - { - get - { - return "Node detached"; - } - } + public string Description => "Node detached"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/NodeNew.cs b/MindMate/Modules/Undo/Changes/NodeNew.cs index e16f2e23..2fe40d17 100644 --- a/MindMate/Modules/Undo/Changes/NodeNew.cs +++ b/MindMate/Modules/Undo/Changes/NodeNew.cs @@ -15,13 +15,7 @@ public NodeNew(MapNode node) this.node = node; } - public string Description - { - get - { - return "New Node"; - } - } + public string Description => "New Node"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/NoteTextChange.cs b/MindMate/Modules/Undo/Changes/NoteTextChange.cs index d715563a..01ae471e 100644 --- a/MindMate/Modules/Undo/Changes/NoteTextChange.cs +++ b/MindMate/Modules/Undo/Changes/NoteTextChange.cs @@ -17,13 +17,7 @@ public NoteTextChange(MapNode node, string oldValue) this.oldValue = oldValue; } - public string Description - { - get - { - return "Rich Content Text Change"; - } - } + public string Description => "Rich Content Text Change"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/ShapeChange.cs b/MindMate/Modules/Undo/Changes/ShapeChange.cs index ce2771ac..7a3836e8 100644 --- a/MindMate/Modules/Undo/Changes/ShapeChange.cs +++ b/MindMate/Modules/Undo/Changes/ShapeChange.cs @@ -17,13 +17,7 @@ public ShapeChange(MapNode node, NodeShape oldValue) this.oldValue = oldValue; } - public string Description - { - get - { - return "Node Shape Change"; - } - } + public string Description => "Node Shape Change"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/StrikeoutChange.cs b/MindMate/Modules/Undo/Changes/StrikeoutChange.cs index b37cea29..769f996f 100644 --- a/MindMate/Modules/Undo/Changes/StrikeoutChange.cs +++ b/MindMate/Modules/Undo/Changes/StrikeoutChange.cs @@ -17,13 +17,7 @@ public StrikeoutChange(MapNode node, bool oldValue) this.oldValue = oldValue; } - public string Description - { - get - { - return "Toggle Strikeout"; - } - } + public string Description => "Toggle Strikeout"; public void Undo() { diff --git a/MindMate/Modules/Undo/Changes/TextChange.cs b/MindMate/Modules/Undo/Changes/TextChange.cs index 5fe39577..ee124d6f 100644 --- a/MindMate/Modules/Undo/Changes/TextChange.cs +++ b/MindMate/Modules/Undo/Changes/TextChange.cs @@ -17,13 +17,7 @@ public TextChange(MapNode node, string oldValue) this.oldText = oldValue; } - public string Description - { - get - { - return "Text Change"; - } - } + public string Description => "Text Change"; public void Undo() { diff --git a/MindMate/Plugins/PluginManager.cs b/MindMate/Plugins/PluginManager.cs index d4192282..b65e8f2f 100644 --- a/MindMate/Plugins/PluginManager.cs +++ b/MindMate/Plugins/PluginManager.cs @@ -231,18 +231,12 @@ public void RescheduleTask(TaskScheduler.ITask task, DateTime startTime) /// /// Currently active MapTree /// - public MapTree ActiveTree - { - get { return mainCtrl.CurrentMapCtrl.MapView.Tree; } - } + public MapTree ActiveTree => mainCtrl.CurrentMapCtrl.MapView.Tree; /// /// Selected Nodes of the currently active MapTree /// - public SelectedNodes ActiveNodes - { - get { return mainCtrl.ActiveNodes; } - } + public SelectedNodes ActiveNodes => mainCtrl.ActiveNodes; #endregion IPluginManager Interface } diff --git a/MindMate/Plugins/Tasks/Model/BaseTaskList.cs b/MindMate/Plugins/Tasks/Model/BaseTaskList.cs index 6b00fc86..d95b0080 100644 --- a/MindMate/Plugins/Tasks/Model/BaseTaskList.cs +++ b/MindMate/Plugins/Tasks/Model/BaseTaskList.cs @@ -31,13 +31,7 @@ public MapNode this[int index] //} } - public int Count - { - get - { - return ((IList)tasks).Count; - } - } + public int Count => ((IList)tasks).Count; //public bool IsReadOnly //{ diff --git a/MindMate/Plugins/Tasks/Model/CompletedTaskEventArgs.cs b/MindMate/Plugins/Tasks/Model/CompletedTaskEventArgs.cs index 94ae6811..57d20529 100644 --- a/MindMate/Plugins/Tasks/Model/CompletedTaskEventArgs.cs +++ b/MindMate/Plugins/Tasks/Model/CompletedTaskEventArgs.cs @@ -15,7 +15,7 @@ public class CompletedTaskEventArgs : EventArgs /// Due to batch updates, OldCompletionDate may be different than current even if TaskChange is not CompletionDateUpdated. /// public DateTime OldCompletionDate { get; set; } - public bool IsOldCompletionDateEmpty { get { return DateTime.MinValue.Equals(OldCompletionDate); } } + public bool IsOldCompletionDateEmpty => DateTime.MinValue.Equals(OldCompletionDate); /// /// OldTaskStatus will be same as current if there is no change. /// diff --git a/MindMate/Plugins/Tasks/Model/PendingTaskEventArgs.cs b/MindMate/Plugins/Tasks/Model/PendingTaskEventArgs.cs index 0fbec2dc..c5edbe26 100644 --- a/MindMate/Plugins/Tasks/Model/PendingTaskEventArgs.cs +++ b/MindMate/Plugins/Tasks/Model/PendingTaskEventArgs.cs @@ -15,7 +15,7 @@ public class PendingTaskEventArgs : EventArgs /// Due to batch updates, OldDueDate may be different than current even if PendingTaskChange is not DueDateUpdated. /// public DateTime OldDueDate { get; set; } - public bool IsOldDueDateEmpty { get { return DateTime.MinValue.Equals(OldDueDate); } } + public bool IsOldDueDateEmpty => DateTime.MinValue.Equals(OldDueDate); /// /// OldTaskStatus will be same as current if there is no change. /// diff --git a/MindMate/Plugins/Tasks/Model/TaskList.cs b/MindMate/Plugins/Tasks/Model/TaskList.cs index f23ff80d..8a36ddb6 100644 --- a/MindMate/Plugins/Tasks/Model/TaskList.cs +++ b/MindMate/Plugins/Tasks/Model/TaskList.cs @@ -40,13 +40,7 @@ public MapNode this[int index] //} } - public int Count - { - get - { - return pendingTasks.Count + completedTasks.Count; - } - } + public int Count => pendingTasks.Count + completedTasks.Count; //public bool IsReadOnly //{ diff --git a/MindMate/Plugins/Tasks/Reminder/ReminderCtrl.cs b/MindMate/Plugins/Tasks/Reminder/ReminderCtrl.cs index c44c44dd..dab615b8 100644 --- a/MindMate/Plugins/Tasks/Reminder/ReminderCtrl.cs +++ b/MindMate/Plugins/Tasks/Reminder/ReminderCtrl.cs @@ -11,7 +11,7 @@ public class ReminderCtrl private readonly TaskPlugin taskPlugin; private readonly TaskReminder reminder; - public TaskReminder TaskReminder { get { return reminder; } } + public TaskReminder TaskReminder => reminder; private readonly List openDialogs; diff --git a/MindMate/Plugins/Tasks/Reminder/TaskReminderDialog.cs b/MindMate/Plugins/Tasks/Reminder/TaskReminderDialog.cs index 29ec0689..6ec7a7be 100644 --- a/MindMate/Plugins/Tasks/Reminder/TaskReminderDialog.cs +++ b/MindMate/Plugins/Tasks/Reminder/TaskReminderDialog.cs @@ -37,8 +37,8 @@ private void TaskReminderDialog_FormClosing(object sender, FormClosingEventArgs TaskViewEvent = null; } - public TaskView TaskView { get { return (TaskView)Controls[0]; } } - + public TaskView TaskView => (TaskView)Controls[0]; + private void onTaskViewEvent(TaskView taskView, TaskView.TaskViewEvent e) { diff --git a/MindMate/Plugins/Tasks/SideBar/ControlGroup.cs b/MindMate/Plugins/Tasks/SideBar/ControlGroup.cs index f37c7bb0..d23c8794 100644 --- a/MindMate/Plugins/Tasks/SideBar/ControlGroup.cs +++ b/MindMate/Plugins/Tasks/SideBar/ControlGroup.cs @@ -28,10 +28,7 @@ public ControlGroup() //table.TabIndex = 3; } - private TableLayoutPanel Table - { - get { return (TableLayoutPanel)this.Controls[1]; } - } + private TableLayoutPanel Table => (TableLayoutPanel)this.Controls[1]; public new event ControlEventHandler ControlAdded { @@ -156,15 +153,9 @@ public void CopyTo(Control[] array, int arrayIndex) } } - public int Count - { - get { return Table.RowCount; } - } + public int Count => Table.RowCount; - public bool IsReadOnly - { - get { return false; } - } + public bool IsReadOnly => false; public bool Remove(Control item) { diff --git a/MindMate/Plugins/Tasks/SideBar/ControlGroupCollection.cs b/MindMate/Plugins/Tasks/SideBar/ControlGroupCollection.cs index 6fd65d14..04670470 100644 --- a/MindMate/Plugins/Tasks/SideBar/ControlGroupCollection.cs +++ b/MindMate/Plugins/Tasks/SideBar/ControlGroupCollection.cs @@ -16,13 +16,10 @@ public class ControlGroupCollection : IList public ControlGroupCollection(SideBar sideBar) { this.sideBar = sideBar; - } - - private TableLayoutPanel Table - { - get { return sideBar.tablePanelMain; } } + private TableLayoutPanel Table => sideBar.tablePanelMain; + public ControlGroup Add(string headerText, System.Drawing.Color headerTextColor) { ControlGroup newControlGroup = CreateControlGroup(); @@ -164,15 +161,9 @@ public void CopyTo(ControlGroup[] array, int arrayIndex) } } - public int Count - { - get { return Table.RowCount; } - } + public int Count => Table.RowCount; - public bool IsReadOnly - { - get { return false; } - } + public bool IsReadOnly => false; public bool Remove(ControlGroup item) { diff --git a/MindMate/Plugins/Tasks/SideBar/SideBar.cs b/MindMate/Plugins/Tasks/SideBar/SideBar.cs index 9636fe56..b69185be 100644 --- a/MindMate/Plugins/Tasks/SideBar/SideBar.cs +++ b/MindMate/Plugins/Tasks/SideBar/SideBar.cs @@ -20,14 +20,8 @@ public SideBar() MyInitializeComponent(); } - private readonly ControlGroupCollection controlGroups; - public ControlGroupCollection ControlGroups - { - get - { - return controlGroups; - } - } + private readonly ControlGroupCollection controlGroups; + public ControlGroupCollection ControlGroups => controlGroups; private void AdjustMainPanelHeight() { diff --git a/MindMate/Plugins/Tasks/TaskCompleteIcon.cs b/MindMate/Plugins/Tasks/TaskCompleteIcon.cs index ebeac6ba..2b968904 100644 --- a/MindMate/Plugins/Tasks/TaskCompleteIcon.cs +++ b/MindMate/Plugins/Tasks/TaskCompleteIcon.cs @@ -27,8 +27,8 @@ public TaskCompleteIcon(CompletedTaskList taskList) } }; } - - public string Name { get { return "TaskCompleted"; } } + + public string Name => "TaskCompleted"; public bool ShowIcon(MapNode node) { @@ -37,10 +37,7 @@ public bool ShowIcon(MapNode node) public event Action StatusChange; - public System.Drawing.Bitmap Bitmap - { - get { return TaskRes.tick; } - } - + public System.Drawing.Bitmap Bitmap => TaskRes.tick; + } } diff --git a/MindMate/Plugins/Tasks/TaskDueIcon.cs b/MindMate/Plugins/Tasks/TaskDueIcon.cs index ebc98bc8..a547a918 100644 --- a/MindMate/Plugins/Tasks/TaskDueIcon.cs +++ b/MindMate/Plugins/Tasks/TaskDueIcon.cs @@ -32,7 +32,7 @@ public TaskDueIcon(PendingTaskList taskList) }; } - public string Name { get { return "TaskPending"; } } + public string Name => "TaskPending"; public bool ShowIcon(MapNode node) { @@ -41,10 +41,7 @@ public bool ShowIcon(MapNode node) public event Action StatusChange; - public System.Drawing.Bitmap Bitmap - { - get { return TaskRes.date; } - } - + public System.Drawing.Bitmap Bitmap => TaskRes.date; + } } diff --git a/MindMate/Plugins/Tasks/TaskList/TaskGroup.cs b/MindMate/Plugins/Tasks/TaskList/TaskGroup.cs index 11cd10cc..5183f764 100644 --- a/MindMate/Plugins/Tasks/TaskList/TaskGroup.cs +++ b/MindMate/Plugins/Tasks/TaskList/TaskGroup.cs @@ -21,10 +21,10 @@ public class TaskGroupOverdue : ITaskGroup public bool CanContain(DateTime dateTime) { return dateTime.Date < DateTime.Today; } public string ShortDueDateString(DateTime dateTime) { return dateTime.ToString("dd-MMM"); } - - public DateTime StartTime { get { return DateTime.MinValue; } } - public DateTime EndTime { get { return DateTime.Today.Subtract(TimeSpan.FromSeconds(1)); } } + public DateTime StartTime => DateTime.MinValue; + + public DateTime EndTime => DateTime.Today.Subtract(TimeSpan.FromSeconds(1)); } @@ -34,9 +34,9 @@ public class TaskGroupToday : ITaskGroup public string ShortDueDateString(DateTime dateTime) { return dateTime.ToShortTimeString(); } - public DateTime StartTime { get { return DateTime.Today; } } + public DateTime StartTime => DateTime.Today; - public DateTime EndTime { get { return DateTime.Today.Add(new TimeSpan(23, 59, 59)); } } + public DateTime EndTime => DateTime.Today.Add(new TimeSpan(23, 59, 59)); } public class TaskGroupTomorrow : ITaskGroup @@ -45,9 +45,9 @@ public class TaskGroupTomorrow : ITaskGroup public string ShortDueDateString(DateTime dateTime) { return dateTime.ToShortTimeString(); } - public DateTime StartTime { get { return DateTime.Today.AddDays(1).Date; } } + public DateTime StartTime => DateTime.Today.AddDays(1).Date; - public DateTime EndTime { get { return StartTime.Add(new TimeSpan(23, 59, 59)); } } + public DateTime EndTime => StartTime.Add(new TimeSpan(23, 59, 59)); } public class TaskGroupThisWeek : ITaskGroup @@ -90,9 +90,9 @@ public bool CanContain(DateTime dateTime) { public string ShortDueDateString(DateTime dateTime) { return dateTime.ToString("dd-MMM"); } - public DateTime StartTime { get { return DateHelper.GetFirstDayOfMonth(DateTime.Now); } } + public DateTime StartTime => DateHelper.GetFirstDayOfMonth(DateTime.Now); - public DateTime EndTime { get { return DateHelper.GetLastDayOfMonth(DateTime.Now).Add(new TimeSpan(23, 59, 59)); } } + public DateTime EndTime => DateHelper.GetLastDayOfMonth(DateTime.Now).Add(new TimeSpan(23, 59, 59)); } public class TaskGroupNextMonth : ITaskGroup @@ -104,9 +104,9 @@ public bool CanContain(DateTime dateTime) { public string ShortDueDateString(DateTime dateTime) { return dateTime.ToString("dd-MMM"); } - public DateTime StartTime { get { return DateHelper.GetFirstDayOfMonth(DateTime.Now.AddMonths(1)); } } + public DateTime StartTime => DateHelper.GetFirstDayOfMonth(DateTime.Now.AddMonths(1)); - public DateTime EndTime { get { return DateHelper.GetLastDayOfMonth(DateTime.Now.AddMonths(1)).Add(new TimeSpan(23, 59, 59)); } } + public DateTime EndTime => DateHelper.GetLastDayOfMonth(DateTime.Now.AddMonths(1)).Add(new TimeSpan(23, 59, 59)); } } diff --git a/MindMate/Plugins/Tasks/TaskList/TaskView.cs b/MindMate/Plugins/Tasks/TaskList/TaskView.cs index d180f84c..59b7001e 100644 --- a/MindMate/Plugins/Tasks/TaskList/TaskView.cs +++ b/MindMate/Plugins/Tasks/TaskList/TaskView.cs @@ -111,13 +111,7 @@ public MapNode MapNode } } - public DateTime DueDate - { - get - { - return MapNode.GetDueDate(); - } - } + public DateTime DueDate => MapNode.GetDueDate(); /// /// Determines if Defer and Expedite task actions are to be shown diff --git a/MindMate/Plugins/Tasks/TaskPlugin.ContextMenu.cs b/MindMate/Plugins/Tasks/TaskPlugin.ContextMenu.cs index 7aa66bdf..bd323969 100644 --- a/MindMate/Plugins/Tasks/TaskPlugin.ContextMenu.cs +++ b/MindMate/Plugins/Tasks/TaskPlugin.ContextMenu.cs @@ -12,12 +12,12 @@ public partial class TaskPlugin : IPluginMapNodeContextMenu { private MenuItem[] menuItems; - private MenuItem SetDueDateMenu { get { return menuItems[0]; } } - private MenuItem UpdateDueDateMenu { get { return menuItems[1]; } } - private MenuItem CompleteTaskMenu { get { return menuItems[3]; } } - private MenuItem RemoveTaskMenu { get { return menuItems[4]; } } + private MenuItem SetDueDateMenu => menuItems[0]; + private MenuItem UpdateDueDateMenu => menuItems[1]; + private MenuItem CompleteTaskMenu => menuItems[3]; + private MenuItem RemoveTaskMenu => menuItems[4]; + - public MenuItem[] CreateContextMenuItemsForNode() { var t1 = new MenuItem("Set Due Date ...", TaskRes.date_add, SetDueDate_Click); diff --git a/MindMate/Plugins/Tasks/TaskPlugin.SystemIcons.cs b/MindMate/Plugins/Tasks/TaskPlugin.SystemIcons.cs index 4a04457e..482700d1 100644 --- a/MindMate/Plugins/Tasks/TaskPlugin.SystemIcons.cs +++ b/MindMate/Plugins/Tasks/TaskPlugin.SystemIcons.cs @@ -20,8 +20,8 @@ public ISystemIcon[] CreateSystemIcons() return systemIcons; } - private TaskDueIcon TaskDueIcon { get { return (TaskDueIcon)systemIcons[0]; } } + private TaskDueIcon TaskDueIcon => (TaskDueIcon)systemIcons[0]; - private TaskCompleteIcon TaskCompleteIcon { get { return (TaskCompleteIcon)systemIcons[1]; } } + private TaskCompleteIcon TaskCompleteIcon => (TaskCompleteIcon)systemIcons[1]; } } diff --git a/MindMate/Plugins/Tasks/TaskPlugin.cs b/MindMate/Plugins/Tasks/TaskPlugin.cs index eed2130f..1ee7c9a2 100644 --- a/MindMate/Plugins/Tasks/TaskPlugin.cs +++ b/MindMate/Plugins/Tasks/TaskPlugin.cs @@ -13,7 +13,7 @@ public partial class TaskPlugin : IPlugin, IPluginMainMenu { private PendingTaskList pendingTasks; - public PendingTaskList PendingTasks { get { return pendingTasks; } } + public PendingTaskList PendingTasks => pendingTasks; private CompletedTaskList completedTasks; @@ -25,7 +25,7 @@ public partial class TaskPlugin : IPlugin, IPluginMainMenu private DateTimePicker dateTimePicker; private TaskListView taskListView; - public TaskListView TaskListView { get { return taskListView; } } + public TaskListView TaskListView => taskListView; public IPluginManager PluginManager { get; private set; } diff --git a/MindMate/Serialization/Dir.cs b/MindMate/Serialization/Dir.cs index e11bea5d..4cfdc610 100644 --- a/MindMate/Serialization/Dir.cs +++ b/MindMate/Serialization/Dir.cs @@ -8,17 +8,13 @@ namespace MindMate.Serialization { public class Dir { - public static string UserSettingsDirectory - { - get - { + public static string UserSettingsDirectory => #if !DEBUG return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + MindMate.Controller.MainCtrl.APPLICATION_NAME + "\\"; #else - return Path.GetTempPath() + MindMate.Controller.MainCtrl.APPLICATION_NAME + "\\"; + Path.GetTempPath() + MindMate.Controller.MainCtrl.APPLICATION_NAME + "\\"; #endif - } - } + } } diff --git a/MindMate/Serialization/PersistenceManager.cs b/MindMate/Serialization/PersistenceManager.cs index 90558b47..242875e7 100644 --- a/MindMate/Serialization/PersistenceManager.cs +++ b/MindMate/Serialization/PersistenceManager.cs @@ -27,18 +27,12 @@ public PersistenceManager() fileList = new List(); } - public bool IsDirty - { - get - { - return !fileList.TrueForAll(t => !t.IsDirty); - } - } + public bool IsDirty => !fileList.TrueForAll(t => !t.IsDirty); #region Tree List private readonly List fileList; - public int FileCount { get { return fileList.Count; } } + public int FileCount => fileList.Count; public IEnumerator GetEnumerator() { diff --git a/MindMate/Serialization/PersistentTree.cs b/MindMate/Serialization/PersistentTree.cs index 992750f9..34934bca 100644 --- a/MindMate/Serialization/PersistentTree.cs +++ b/MindMate/Serialization/PersistentTree.cs @@ -59,13 +59,7 @@ internal void Initialize(string fileName) public string FileName { get; private set; } - public bool IsNewMap - { - get - { - return FileName == null; - } - } + public bool IsNewMap => FileName == null; private bool isDirty; public bool IsDirty diff --git a/MindMate/View/Dialogs/AboutBox.cs b/MindMate/View/Dialogs/AboutBox.cs index 5bc6adbc..139dc684 100644 --- a/MindMate/View/Dialogs/AboutBox.cs +++ b/MindMate/View/Dialogs/AboutBox.cs @@ -42,13 +42,7 @@ public string AssemblyTitle } } - public string AssemblyVersion - { - get - { - return Assembly.GetExecutingAssembly().GetName().Version.ToString(); - } - } + public string AssemblyVersion => Assembly.GetExecutingAssembly().GetName().Version.ToString(); public string AssemblyDescription { diff --git a/MindMate/View/Dialogs/IconSelectorExt.cs b/MindMate/View/Dialogs/IconSelectorExt.cs index b1630275..a3b47773 100644 --- a/MindMate/View/Dialogs/IconSelectorExt.cs +++ b/MindMate/View/Dialogs/IconSelectorExt.cs @@ -212,10 +212,7 @@ private void btnCancel_Click(object sender, System.EventArgs e) #region Customize Icon Selector Dialog ********************************* - public bool IsCustomizing - { - get { return toolStrip2.Visible; } - } + public bool IsCustomizing => toolStrip2.Visible; private void StartCustomizing() { diff --git a/MindMate/View/EditorTabs/TabBase.cs b/MindMate/View/EditorTabs/TabBase.cs index a98f51b2..1ecca8c7 100644 --- a/MindMate/View/EditorTabs/TabBase.cs +++ b/MindMate/View/EditorTabs/TabBase.cs @@ -21,6 +21,6 @@ public virtual void Close() /// /// Child Control of the tab. All tabs should have one control only. /// - public Control Control { get { return Controls[0]; } } + public Control Control => Controls[0]; } } diff --git a/MindMate/View/MapControls/IconView.cs b/MindMate/View/MapControls/IconView.cs index 770c992f..25066656 100644 --- a/MindMate/View/MapControls/IconView.cs +++ b/MindMate/View/MapControls/IconView.cs @@ -36,37 +36,19 @@ public PointF Location set { location = value; } } - - public Size Size - { - get - { - return iconSpec.Bitmap.Size; - } - } + + public Size Size => iconSpec.Bitmap.Size; public bool Contains(Point p) { return p.X >= Location.X && p.Y >= Location.Y && p.X <= Location.X + Size.Width && p.Y <= Location.Y + Size.Height; } - public string Name - { - get - { - return iconSpec.Name; - } - } + public string Name => iconSpec.Name; readonly IIcon iconSpec; - public IIcon IconSpec - { - get - { - return iconSpec; - } - } + public IIcon IconSpec => iconSpec; public void Draw(Graphics g) { diff --git a/MindMate/View/MapControls/Link.cs b/MindMate/View/MapControls/Link.cs index a1653237..085c6861 100644 --- a/MindMate/View/MapControls/Link.cs +++ b/MindMate/View/MapControls/Link.cs @@ -69,14 +69,8 @@ public PointF Location set { location = value; } } - - public Size Size - { - get - { - return bitmap.Size; - } - } + + public Size Size => bitmap.Size; public bool Contains(Point p) { @@ -85,13 +79,7 @@ public bool Contains(Point p) Bitmap bitmap; - public Bitmap Bitmap - { - get - { - return bitmap; - } - } + public Bitmap Bitmap => bitmap; public void Draw(Graphics g) { diff --git a/MindMate/View/MapControls/MapView.cs b/MindMate/View/MapControls/MapView.cs index ecc31ce8..701f673d 100644 --- a/MindMate/View/MapControls/MapView.cs +++ b/MindMate/View/MapControls/MapView.cs @@ -63,10 +63,7 @@ public MapView(MapTree tree) } private readonly MapTree tree; - public MapTree Tree - { - get { return tree; } - } + public MapTree Tree => tree; public void CenterOnForm() { @@ -89,33 +86,15 @@ private void RegisterTreeEvents() public MapViewPanel Canvas { get; set; } - public SelectedNodes SelectedNodes - { - get - { - return Tree.SelectedNodes; - } - } + public SelectedNodes SelectedNodes => Tree.SelectedNodes; private readonly MapViewTextEditor nodeTextEditor; - public MapViewTextEditor NodeTextEditor - { - get - { - return nodeTextEditor; - } - } + public MapViewTextEditor NodeTextEditor => nodeTextEditor; public MapViewFormatPainter FormatPainter { get; private set; } private MapNode highlightedNode; - public MapNode HighlightedNode - { - get - { - return highlightedNode; - } - } + public MapNode HighlightedNode => highlightedNode; public void HighlightNode(MapNode node) { highlightedNode = node; Canvas.Invalidate(); } diff --git a/MindMate/View/MapControls/MapViewDragHandler.cs b/MindMate/View/MapControls/MapViewDragHandler.cs index ef6c5900..ea5a8de9 100644 --- a/MindMate/View/MapControls/MapViewDragHandler.cs +++ b/MindMate/View/MapControls/MapViewDragHandler.cs @@ -66,20 +66,11 @@ internal void OnMouseDrop(MouseEventArgs e) /// /// /// - public bool IsDragging - { - get { return this.dragObject != null; } - } + public bool IsDragging => this.dragObject != null; - public bool IsCanvasDragging - { - get { return dragObject == MapView.Canvas; } - } + public bool IsCanvasDragging => dragObject == MapView.Canvas; - public bool IsNodeDragging - { - get { return dragObject != null && dragObject != MapView.Canvas; } - } + public bool IsNodeDragging => dragObject != null && dragObject != MapView.Canvas; public DropLocation NodeDropLocation { @@ -204,11 +195,8 @@ public struct DropLocation public MapNode Parent; public MapNode Sibling; public bool InsertAfterSibling; - - public bool IsEmpty - { - get { return Parent == null; } - } + + public bool IsEmpty => Parent == null; public override bool Equals(object obj) { diff --git a/MindMate/View/MapControls/MapViewFormatPainter.cs b/MindMate/View/MapControls/MapViewFormatPainter.cs index dcdf443e..fa9e990f 100644 --- a/MindMate/View/MapControls/MapViewFormatPainter.cs +++ b/MindMate/View/MapControls/MapViewFormatPainter.cs @@ -20,7 +20,7 @@ public MapViewFormatPainter(MapView mapView) public FormatPainterStatus Status { get; private set; } - public bool Active { get { return Status != FormatPainterStatus.Empty; } } + public bool Active => Status != FormatPainterStatus.Empty; public event Action StateChanged; diff --git a/MindMate/View/MapControls/NodeView.cs b/MindMate/View/MapControls/NodeView.cs index d583c7ae..9bdcb892 100644 --- a/MindMate/View/MapControls/NodeView.cs +++ b/MindMate/View/MapControls/NodeView.cs @@ -38,28 +38,25 @@ public class NodeView public const int ICON_SIZE = 16; private readonly MapNode node; - public MapNode Node {get{ return node; }} + public MapNode Node => node; private Link link; - public Link Link - { - get { return link; } - } + public Link Link => link; private NoteIcon noteIcon; /// /// Gets NoteIcon /// - public NoteIcon NoteIcon { get { return noteIcon; } } + public NoteIcon NoteIcon => noteIcon; private RectangleF recText; /// /// Gets the rectangle for the node text /// - public RectangleF RecText { get { return recText; } } + public RectangleF RecText => recText; - private readonly List recIcons = new List(); - public List RecIcons { get { return recIcons; } } + private readonly List recIcons = new List(); + public List RecIcons => recIcons; private NodeFormat nodeFomat; public NodeFormat NodeFormat => nodeFomat; @@ -84,55 +81,31 @@ public NodeView(MapNode node) private float left; - public float Left - { - get { return left; } - } + public float Left => left; private float top; - public float Top - { - get { return top; } - } + public float Top => top; private float height; /// /// Height of the node (without considering child nodes) /// - public float Height - { - get { return height; } - } + public float Height => height; private float width; /// /// Width of the node (without considering child nodes) /// - public float Width - { - get { return width; } - } + public float Width => width; - public float Bottom - { - get { return top + height; } - } + public float Bottom => top + height; - public float Right - { - get { return left + width; } - } + public float Right => left + width; - public bool IsMultiline - { - get - { - return NodeFormat.Font.Height*2 <= recText.Height; - } - } + public bool IsMultiline => NodeFormat.Font.Height * 2 <= recText.Height; /// /// Returns last selected child node or the first child diff --git a/MindMate/View/MapControls/NoteIcon.cs b/MindMate/View/MapControls/NoteIcon.cs index e437db8c..c40d40e9 100644 --- a/MindMate/View/MapControls/NoteIcon.cs +++ b/MindMate/View/MapControls/NoteIcon.cs @@ -27,14 +27,8 @@ public PointF Location set { location = value; } } - - public Size Size - { - get - { - return bitmap.Size; - } - } + + public Size Size => bitmap.Size; public bool Contains(Point p) { @@ -43,13 +37,7 @@ public bool Contains(Point p) readonly Bitmap bitmap; - public Bitmap Bitmap - { - get - { - return bitmap; - } - } + public Bitmap Bitmap => bitmap; public void Draw(Graphics g) { diff --git a/MindMate/View/NoteEditing/ImageLocalPath.cs b/MindMate/View/NoteEditing/ImageLocalPath.cs index 4be62794..a3c978c5 100644 --- a/MindMate/View/NoteEditing/ImageLocalPath.cs +++ b/MindMate/View/NoteEditing/ImageLocalPath.cs @@ -21,11 +21,11 @@ public class ImageLocalPath /// /// Name of file with extension /// - public string FileName { get { return FileNameWithoutExt + "." + Extension; } } + public string FileName => FileNameWithoutExt + "." + Extension; /// /// Url with mm protocol, file name and extension /// - public string Url { get { return Protocol + FileName; } } + public string Url => Protocol + FileName; private ImageLocalPath(string fileNameWithoutExt, string extension) { diff --git a/MindMate/View/NoteEditing/MsHtmlWrap/HtmlImageCreator.cs b/MindMate/View/NoteEditing/MsHtmlWrap/HtmlImageCreator.cs index 82b7d19a..39f4c8e0 100644 --- a/MindMate/View/NoteEditing/MsHtmlWrap/HtmlImageCreator.cs +++ b/MindMate/View/NoteEditing/MsHtmlWrap/HtmlImageCreator.cs @@ -42,8 +42,7 @@ public class HtmlImageCreator { readonly NoteEditor editor; - private HtmlDocument Document - { get { return (HtmlDocument)editor.Document.DomDocument; } } + private HtmlDocument Document => (HtmlDocument)editor.Document.DomDocument; public HtmlImageCreator(NoteEditor editor) { diff --git a/MindMate/View/NoteEditing/MsHtmlWrap/HtmlTableHelper.cs b/MindMate/View/NoteEditing/MsHtmlWrap/HtmlTableHelper.cs index cdd939df..a017e189 100644 --- a/MindMate/View/NoteEditing/MsHtmlWrap/HtmlTableHelper.cs +++ b/MindMate/View/NoteEditing/MsHtmlWrap/HtmlTableHelper.cs @@ -39,8 +39,7 @@ public class HtmlTableHelper { readonly NoteEditor editor; - private HtmlDocument Document - { get { return (HtmlDocument)editor.Document.DomDocument; } } + private HtmlDocument Document => (HtmlDocument)editor.Document.DomDocument; public HtmlTableHelper(NoteEditor editor) { diff --git a/MindMate/View/NoteEditing/MsHtmlWrap/MarkupPointer.cs b/MindMate/View/NoteEditing/MsHtmlWrap/MarkupPointer.cs index 7fdd373b..a9a7fc8e 100644 --- a/MindMate/View/NoteEditing/MsHtmlWrap/MarkupPointer.cs +++ b/MindMate/View/NoteEditing/MsHtmlWrap/MarkupPointer.cs @@ -21,13 +21,7 @@ internal MarkupPointer(MshtmlMarkupServices markupServices, IMarkupPointerRaw po _pointerRaw = pointer; } - public IMarkupPointerRaw PointerRaw - { - get - { - return _pointerRaw; - } - } + public IMarkupPointerRaw PointerRaw => _pointerRaw; /// /// Enable/Disable the cling attribute for this markup pointer. diff --git a/MindMate/View/NoteEditing/NoteEditor.cs b/MindMate/View/NoteEditing/NoteEditor.cs index bd315ce5..3664615b 100644 --- a/MindMate/View/NoteEditing/NoteEditor.cs +++ b/MindMate/View/NoteEditing/NoteEditor.cs @@ -347,15 +347,9 @@ public void InsertHyperlink(string url) // htmlDoc.execCommand("InsertImage", true, null); //} - public bool DocumentReady - { - get { return htmlDoc.readyState.Equals("complete", StringComparison.OrdinalIgnoreCase); } - } + public bool DocumentReady => htmlDoc.readyState.Equals("complete", StringComparison.OrdinalIgnoreCase); - public bool Empty - { - get { return htmlDoc.body.innerHTML == null || htmlDoc.body.innerHTML == "

 

"; } - } + public bool Empty => htmlDoc.body.innerHTML == null || htmlDoc.body.innerHTML == "

 

"; /// /// Text color for the current selection diff --git a/MindMate/View/NoteEditing/NoteMapGlue.cs b/MindMate/View/NoteEditing/NoteMapGlue.cs index c13971c7..ab8e9ada 100644 --- a/MindMate/View/NoteEditing/NoteMapGlue.cs +++ b/MindMate/View/NoteEditing/NoteMapGlue.cs @@ -23,13 +23,7 @@ public class NoteMapGlue { private readonly NoteEditor editor; - public NoteEditor Editor - { - get - { - return editor; - } - } + public NoteEditor Editor => editor; public MapNode CurrentMapNpde { get; private set; } diff --git a/MindMate/View/NoteEditing/PluggableProtocol/ProtocolBase.cs b/MindMate/View/NoteEditing/PluggableProtocol/ProtocolBase.cs index 6b4592a2..f4dc9291 100644 --- a/MindMate/View/NoteEditing/PluggableProtocol/ProtocolBase.cs +++ b/MindMate/View/NoteEditing/PluggableProtocol/ProtocolBase.cs @@ -101,13 +101,7 @@ protected byte[] Data private int position = 0; - private int RemainingDataLength - { - get - { - return data.Length - position; - } - } + private int RemainingDataLength => data.Length - position; } diff --git a/MindMate/View/SideTabControl.cs b/MindMate/View/SideTabControl.cs index cde137fd..fd6d5f3b 100644 --- a/MindMate/View/SideTabControl.cs +++ b/MindMate/View/SideTabControl.cs @@ -44,29 +44,11 @@ public SideTabControl() public TabPage NoteTab { get; private set; } //TODO: Should be handled the way 'View Calendar' ribbon command is done. - public TabPage TaskListTab - { - get - { - return TabPages.Cast().FirstOrDefault(p => p.Text == TaskListTabTitle); - } - } + public TabPage TaskListTab => TabPages.Cast().FirstOrDefault(p => p.Text == TaskListTabTitle); - public TabPage SearchTab - { - get - { - return TabPages.Cast().First(p => p.Text == SearchTabTitle); - } - } + public TabPage SearchTab => TabPages.Cast().First(p => p.Text == SearchTabTitle); - public SearchControl SearchControl - { - get - { - return SearchTab.Controls[0] as SearchControl; - } - } + public SearchControl SearchControl => SearchTab.Controls[0] as SearchControl; } } From c61792de6d21c2949e25bd067776b05422d708c8 Mon Sep 17 00:00:00 2001 From: Lehonti Ramos Date: Mon, 4 Sep 2023 17:50:42 +0200 Subject: [PATCH 2/5] Removed unused namespace references in a few files under `MindMate\Controller` --- MindMate/Controller/MapViewKeyEventHandler.cs | 7 +------ MindMate/Controller/MapViewMouseEventHandler.cs | 7 +------ MindMate/Controller/NoteEditorCtrl.cs | 5 ----- MindMate/Controller/SearchController.cs | 8 +++----- MindMate/Controller/StatusBarCtrl.cs | 5 ----- MindMate/Controller/TabController.cs | 4 ---- MindMate/Controller/WinFormsStatusBarCtrl.cs | 7 +------ 7 files changed, 6 insertions(+), 37 deletions(-) diff --git a/MindMate/Controller/MapViewKeyEventHandler.cs b/MindMate/Controller/MapViewKeyEventHandler.cs index b8a94287..4274d3c0 100644 --- a/MindMate/Controller/MapViewKeyEventHandler.cs +++ b/MindMate/Controller/MapViewKeyEventHandler.cs @@ -3,13 +3,8 @@ * This software is licensed under MIT (see LICENSE.txt) */ -using MindMate.Model; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Forms; using MindMate.View.MapControls; +using System.Windows.Forms; namespace MindMate.Controller { diff --git a/MindMate/Controller/MapViewMouseEventHandler.cs b/MindMate/Controller/MapViewMouseEventHandler.cs index 9a948a86..c213e0ad 100644 --- a/MindMate/Controller/MapViewMouseEventHandler.cs +++ b/MindMate/Controller/MapViewMouseEventHandler.cs @@ -3,14 +3,9 @@ * This software is licensed under MIT (see LICENSE.txt) */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using MindMate.Serialization; using MindMate.Model; using MindMate.View.MapControls; +using System.Windows.Forms; namespace MindMate.Controller { diff --git a/MindMate/Controller/NoteEditorCtrl.cs b/MindMate/Controller/NoteEditorCtrl.cs index 61d72ba2..7ca46986 100644 --- a/MindMate/Controller/NoteEditorCtrl.cs +++ b/MindMate/Controller/NoteEditorCtrl.cs @@ -2,12 +2,7 @@ using MindMate.View.Dialogs; using MindMate.View.NoteEditing; using mshtml; -using System; -using System.Collections.Generic; using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; namespace MindMate.Controller { diff --git a/MindMate/Controller/SearchController.cs b/MindMate/Controller/SearchController.cs index 2afee4f6..d87a472f 100644 --- a/MindMate/Controller/SearchController.cs +++ b/MindMate/Controller/SearchController.cs @@ -1,10 +1,8 @@ -using System; +using MindMate.Model; +using MindMate.View.Search; +using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using MindMate.Model; -using MindMate.View.Search; namespace MindMate.Controller { diff --git a/MindMate/Controller/StatusBarCtrl.cs b/MindMate/Controller/StatusBarCtrl.cs index 19cf8b7a..6e0e1451 100644 --- a/MindMate/Controller/StatusBarCtrl.cs +++ b/MindMate/Controller/StatusBarCtrl.cs @@ -3,13 +3,8 @@ * This software is licensed under MIT (see LICENSE.txt) */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using MindMate.Model; using MindMate.Serialization; -using MindMate.View.MapControls; namespace MindMate.Controller { diff --git a/MindMate/Controller/TabController.cs b/MindMate/Controller/TabController.cs index f0187936..c96b024e 100644 --- a/MindMate/Controller/TabController.cs +++ b/MindMate/Controller/TabController.cs @@ -1,10 +1,6 @@ using MindMate.View; using MindMate.View.EditorTabs; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Forms; namespace MindMate.Controller { diff --git a/MindMate/Controller/WinFormsStatusBarCtrl.cs b/MindMate/Controller/WinFormsStatusBarCtrl.cs index 5a74aee3..8a96239c 100644 --- a/MindMate/Controller/WinFormsStatusBarCtrl.cs +++ b/MindMate/Controller/WinFormsStatusBarCtrl.cs @@ -3,14 +3,9 @@ * This software is licensed under MIT (see LICENSE.txt) */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using MindMate.Model; -using MindMate.View.MapControls; -using System.Windows.Forms; using MindMate.Serialization; +using System.Windows.Forms; namespace MindMate.Controller { From feac1194cb17b38a606cb81f421ad54460a43e3e Mon Sep 17 00:00:00 2001 From: Lehonti Ramos Date: Tue, 5 Sep 2023 22:08:56 +0200 Subject: [PATCH 3/5] Modernized getter and setter syntax --- MindMate.Win7/MainForm.cs | 24 ++-- .../View/Ribbon/GalleryIconPropertySet.cs | 37 ++---- .../Ribbon/GalleryNodeStylePropertySet.cs | 32 ++--- MindMate.Win7/View/Ribbon/Ribbon.cs | 18 +-- MindMate.WinXP/MainForm.cs | 24 ++-- MindMate.WinXP/MainMenuCtrl.cs | 10 +- MindMate/MetaModel/ModelIcon.cs | 18 ++- MindMate/Model/AttributeSpec.cs | 100 ++++++++------- MindMate/Model/MapNode.cs | 119 ++++++------------ MindMate/Model/MapTree.cs | 12 +- MindMate/Plugins/MenuItem.cs | 30 +---- MindMate/Plugins/Tasks/DateTimePicker.cs | 11 +- .../Plugins/Tasks/SideBar/CollapsiblePanel.cs | 53 +++----- .../Plugins/Tasks/SideBar/ControlGroup.cs | 32 +---- .../Tasks/SideBar/ControlGroupCollection.cs | 16 +-- MindMate/Plugins/Tasks/TaskList/TaskView.cs | 65 +++------- MindMate/Serialization/PersistenceManager.cs | 7 +- MindMate/Serialization/PersistentTree.cs | 10 +- MindMate/View/Dialogs/InputBox.cs | 19 +-- MindMate/View/Dialogs/LinkManualEdit.cs | 17 +-- MindMate/View/EditorTabs/EditorTabs.cs | 11 +- MindMate/View/MapControls/IconView.cs | 10 +- MindMate/View/MapControls/Link.cs | 14 +-- .../View/MapControls/MapViewTextEditor.cs | 17 +-- MindMate/View/MapControls/NoteIcon.cs | 8 +- MindMate/View/NoteEditing/HtmlSourceDialog.cs | 19 +-- .../MsHtmlWrap/HtmlEditorException.cs | 13 +- .../NoteEditing/MsHtmlWrap/MarkupPointer.cs | 19 +-- MindMate/View/NoteEditing/NoteEditor.cs | 31 ++--- .../PluggableProtocol/ProtocolBase.cs | 6 +- .../View/NoteEditing/TablePropertyForm.cs | 15 +-- 31 files changed, 240 insertions(+), 577 deletions(-) diff --git a/MindMate.Win7/MainForm.cs b/MindMate.Win7/MainForm.cs index 2d0bfb2a..2ef370eb 100644 --- a/MindMate.Win7/MainForm.cs +++ b/MindMate.Win7/MainForm.cs @@ -3,13 +3,13 @@ * This software is licensed under MIT (see LICENSE.txt) */ -using System; -using System.Windows.Forms; -using MindMate.Plugins; -using MindMate.View.NoteEditing; using MindMate.Controller; +using MindMate.Plugins; using MindMate.View; using MindMate.View.EditorTabs; +using MindMate.View.NoteEditing; +using System; +using System.Windows.Forms; namespace MindMate.Win7 { @@ -45,17 +45,14 @@ public MainForm(MainCtrl mainCtrl) private Control focusedControl; public Control FocusedControl { - get - { - return focusedControl; - } + get => focusedControl; set { if (focusedControl != value) { var oldvalue = focusedControl; - focusedControl = value; + focusedControl = value; FocusedControlChanged?.Invoke(value, oldvalue); } } @@ -100,13 +97,10 @@ private void SplitContainer1_GotFocus(object sender, EventArgs e) public SideTabControl SideBarTabs { get; private set; } public NoteEditor NoteEditor { get; private set; } - public View.StatusBar StatusBar { get { return this.statusStrip1; } } + public View.StatusBar StatusBar => this.statusStrip1; + + public bool IsNoteEditorActive => ActiveControl == splitContainer1 && splitContainer1.ActiveControl == NoteEditor; - public bool IsNoteEditorActive - { - get { return ActiveControl == splitContainer1 && splitContainer1.ActiveControl == NoteEditor; } - } - private void SetupSideBar() { SideBarTabs = new SideTabControl(); diff --git a/MindMate.Win7/View/Ribbon/GalleryIconPropertySet.cs b/MindMate.Win7/View/Ribbon/GalleryIconPropertySet.cs index 22e46e12..8fd48423 100644 --- a/MindMate.Win7/View/Ribbon/GalleryIconPropertySet.cs +++ b/MindMate.Win7/View/Ribbon/GalleryIconPropertySet.cs @@ -1,6 +1,6 @@ -using System.Diagnostics; -using MindMate.MetaModel; +using MindMate.MetaModel; using RibbonLib.Interop; +using System.Diagnostics; namespace MindMate.View.Ribbon { @@ -16,41 +16,20 @@ public GalleryIconPropertySet(ModelIcon icon, RibbonLib.Ribbon ribbon) private uint? categoryId; private IUIImage itemImage; - public string Label - { - get - { - return icon.Title; - } - } + public string Label => icon.Title; - public string Name - { - get { return icon.Name; } - } + public string Name => icon.Name; public uint CategoryID { - get - { - return categoryId.GetValueOrDefault(Constants.UI_Collection_InvalidIndex); - } - set - { - categoryId = value; - } + get => categoryId.GetValueOrDefault(Constants.UI_Collection_InvalidIndex); + set => categoryId = value; } public IUIImage ItemImage { - get - { - return itemImage; - } - set - { - itemImage = value; - } + get => itemImage; + set => itemImage = value; } #region IUISimplePropertySet Members diff --git a/MindMate.Win7/View/Ribbon/GalleryNodeStylePropertySet.cs b/MindMate.Win7/View/Ribbon/GalleryNodeStylePropertySet.cs index b40bf8c7..87895cb0 100644 --- a/MindMate.Win7/View/Ribbon/GalleryNodeStylePropertySet.cs +++ b/MindMate.Win7/View/Ribbon/GalleryNodeStylePropertySet.cs @@ -1,6 +1,6 @@ -using System.Diagnostics; -using MindMate.MetaModel; +using MindMate.MetaModel; using RibbonLib.Interop; +using System.Diagnostics; namespace MindMate.View.Ribbon { @@ -16,36 +16,18 @@ public GalleryNodeStylePropertySet(NodeStyle style, RibbonLib.Ribbon ribbon) private uint? categoryId; private IUIImage itemImage; - public NodeStyle NodeStyle - { - get - { - return style; - } - } + public NodeStyle NodeStyle => style; public uint CategoryID { - get - { - return categoryId.GetValueOrDefault(Constants.UI_Collection_InvalidIndex); - } - set - { - categoryId = value; - } + get => categoryId.GetValueOrDefault(Constants.UI_Collection_InvalidIndex); + set => categoryId = value; } public IUIImage ItemImage { - get - { - return itemImage; - } - set - { - itemImage = value; - } + get => itemImage; + set => itemImage = value; } #region IUISimplePropertySet Members diff --git a/MindMate.Win7/View/Ribbon/Ribbon.cs b/MindMate.Win7/View/Ribbon/Ribbon.cs index 82388195..cdc99ebb 100644 --- a/MindMate.Win7/View/Ribbon/Ribbon.cs +++ b/MindMate.Win7/View/Ribbon/Ribbon.cs @@ -1,16 +1,16 @@ -using MindMate.Model; +using MindMate.MetaModel; +using MindMate.Model; +using MindMate.Plugins; +using MindMate.View.EditorTabs; +using MindMate.Win7.Properties; +using RibbonLib; using RibbonLib.Controls.Events; +using RibbonLib.Interop; using System; using System.Collections.Generic; -using System.Windows.Forms; -using RibbonLib.Interop; using System.Drawing; using System.Drawing.Drawing2D; -using MindMate.MetaModel; -using MindMate.Plugins; -using MindMate.View.EditorTabs; -using MindMate.Win7.Properties; -using RibbonLib; +using System.Windows.Forms; namespace MindMate.View.Ribbon { @@ -840,7 +840,7 @@ private void MoveDown_ExecuteEvent(object sender, ExecuteEventArgs e) private const string AscendingOrderString = "Ascending Order"; private const string DescendingOrderString = "Descending Order"; - private bool IsAscendingSortOrder { get { return SortOrder.Label == AscendingOrderString || SortOrder.Label == null; }} + private bool IsAscendingSortOrder => SortOrder.Label == AscendingOrderString || SortOrder.Label == null; private void SortAlphabetic_ExecuteEvent(object sender, ExecuteEventArgs e) { diff --git a/MindMate.WinXP/MainForm.cs b/MindMate.WinXP/MainForm.cs index 42001401..712c8097 100644 --- a/MindMate.WinXP/MainForm.cs +++ b/MindMate.WinXP/MainForm.cs @@ -3,12 +3,12 @@ * This software is licensed under MIT (see LICENSE.txt) */ -using System; -using System.Windows.Forms; using MindMate.Plugins; -using MindMate.View.NoteEditing; using MindMate.View; using MindMate.View.EditorTabs; +using MindMate.View.NoteEditing; +using System; +using System.Windows.Forms; namespace MindMate.WinXP { @@ -35,17 +35,14 @@ public MainForm() private Control focusedControl; public Control FocusedControl { - get - { - return focusedControl; - } + get => focusedControl; set { if (focusedControl != value) { var oldvalue = focusedControl; - focusedControl = value; + focusedControl = value; FocusedControlChanged?.Invoke(value, oldvalue); } } @@ -83,20 +80,17 @@ private void SplitContainer1_GotFocus(object sender, EventArgs e) #endregion - public MainMenu MainMenu { get { return menuStrip; } } + public MainMenu MainMenu => menuStrip; public MainMenuCtrl MainMenuCtrl { get; set; } public EditorTabs EditorTabs { get; private set; } public SideTabControl SideBarTabs { get; private set; } public NoteEditor NoteEditor { get; private set; } - public View.StatusBar StatusBar { get { return this.statusStrip1; } } + public View.StatusBar StatusBar => this.statusStrip1; + + public bool IsNoteEditorActive => ActiveControl == splitContainer1 && splitContainer1.ActiveControl == NoteEditor; - public bool IsNoteEditorActive - { - get { return ActiveControl == splitContainer1 && splitContainer1.ActiveControl == NoteEditor; } - } - private void SetupSideBar() { SideBarTabs = new SideTabControl(); diff --git a/MindMate.WinXP/MainMenuCtrl.cs b/MindMate.WinXP/MainMenuCtrl.cs index 8da66166..ddbbaab4 100644 --- a/MindMate.WinXP/MainMenuCtrl.cs +++ b/MindMate.WinXP/MainMenuCtrl.cs @@ -3,14 +3,10 @@ * This software is licensed under MIT (see LICENSE.txt) */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using MindMate.View; -using System.Windows.Forms; using MindMate.Controller; using MindMate.Plugins; +using System; +using System.Windows.Forms; namespace MindMate.WinXP { @@ -21,7 +17,7 @@ namespace MindMate.WinXP public class MainMenuCtrl { public MainMenu mainMenu; - public MapCtrl mapCtrl { get { return mainCtrl.CurrentMapCtrl; } } + public MapCtrl mapCtrl => mainCtrl.CurrentMapCtrl; private readonly MainCtrl mainCtrl; public MainMenuCtrl(MainMenu mainMenu, MainCtrl mainCtrl) diff --git a/MindMate/MetaModel/ModelIcon.cs b/MindMate/MetaModel/ModelIcon.cs index 73a31249..9d4fad05 100644 --- a/MindMate/MetaModel/ModelIcon.cs +++ b/MindMate/MetaModel/ModelIcon.cs @@ -3,11 +3,6 @@ * This software is licensed under MIT (see LICENSE.txt) */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Forms; using System.Drawing; namespace MindMate.MetaModel @@ -38,8 +33,9 @@ private ModelIcon() //[ProtoBuf.ProtoMember(1)] public string Name { - get { return name; } - set { + get => name; + set + { name = value; this.bitmap = MindMate.Serialization.IconImageLoader.GetIcon(name); } @@ -49,16 +45,16 @@ public string Name //[ProtoBuf.ProtoMember(2)] public string Title { - get { return title; } - set { title = value; } + get => title; + set => title = value; } private string shortcut; //[ProtoBuf.ProtoMember(3)] public string Shortcut { - get { return shortcut; } - set { shortcut = value; } + get => shortcut; + set => shortcut = value; } private Bitmap bitmap; diff --git a/MindMate/Model/AttributeSpec.cs b/MindMate/Model/AttributeSpec.cs index 0c54fe32..669dd6da 100644 --- a/MindMate/Model/AttributeSpec.cs +++ b/MindMate/Model/AttributeSpec.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; namespace MindMate.Model { @@ -37,78 +35,78 @@ public AttributeSpec(MapTree tree, string name, bool visible = true, AttributeDa /// /// Name is unique across all attributes except Calculated type. Calculated type attribute has same name as the attribute it aggregates on. /// - public string Name - { - get { return name; } - set + public string Name { - object oldValue = name; - name = value; - Tree.FireEvent(this, new AttributeSpecEventArgs() { Change = AttributeSpecChange.NameChanged, OldValue = oldValue }); + get => name; + set + { + object oldValue = name; + name = value; + Tree.FireEvent(this, new AttributeSpecEventArgs() { Change = AttributeSpecChange.NameChanged, OldValue = oldValue }); + } } - } - private bool visible; + private bool visible; /// /// Show attribute in the Map /// - public bool Visible - { - get { return visible; } - set + public bool Visible { - visible = value; - Tree.FireEvent(this, new AttributeSpecEventArgs() { Change = AttributeSpecChange.VisibilityChanged }); + get => visible; + set + { + visible = value; + Tree.FireEvent(this, new AttributeSpecEventArgs() { Change = AttributeSpecChange.VisibilityChanged }); + } } - } - private AttributeType type; - public AttributeType Type - { - get { return type; } - set + private AttributeType type; + public AttributeType Type { - object oldValue = type; - type = value; - Tree.FireEvent(this, new AttributeSpecEventArgs() { Change = AttributeSpecChange.TypeChanged, OldValue = oldValue }); + get => type; + set + { + object oldValue = type; + type = value; + Tree.FireEvent(this, new AttributeSpecEventArgs() { Change = AttributeSpecChange.TypeChanged, OldValue = oldValue }); + } } - } - private AttributeDataType dataType; - public AttributeDataType DataType - { - get { return dataType; } - set + private AttributeDataType dataType; + public AttributeDataType DataType { - object oldValue = dataType; - dataType = value; - Tree.FireEvent(this, new AttributeSpecEventArgs() { Change = AttributeSpecChange.DataTypedChanged, OldValue = oldValue }); + get => dataType; + set + { + object oldValue = dataType; + dataType = value; + Tree.FireEvent(this, new AttributeSpecEventArgs() { Change = AttributeSpecChange.DataTypedChanged, OldValue = oldValue }); + } } - } - private AttributeListOption listType; + private AttributeListOption listType; /// /// Always NoList for DateTime and Date /// - public AttributeListOption ListType - { - get { return listType; } - set + public AttributeListOption ListType { - object oldValue = listType; - listType = value; - Tree.FireEvent(this, new AttributeSpecEventArgs() { Change = AttributeSpecChange.ListTypeChanged, OldValue = oldValue }); + get => listType; + set + { + object oldValue = listType; + listType = value; + Tree.FireEvent(this, new AttributeSpecEventArgs() { Change = AttributeSpecChange.ListTypeChanged, OldValue = oldValue }); + } } - } - - #region Attribute List of Values ********************** - /// - /// List of values are maintained if AttributeListOption is RestrictedList or OptionalList - /// - private readonly SortedSet values; + #region Attribute List of Values ********************** + + /// + /// List of values are maintained if AttributeListOption is RestrictedList or OptionalList + /// + private readonly SortedSet values; /// /// List of values are maintained if AttributeListOption is RestrictedList or OptionalList diff --git a/MindMate/Model/MapNode.cs b/MindMate/Model/MapNode.cs index 93df03ea..11e13227 100644 --- a/MindMate/Model/MapNode.cs +++ b/MindMate/Model/MapNode.cs @@ -3,15 +3,13 @@ * This software is licensed under MIT (see LICENSE.txt) */ +using MindMate.Serialization; +using MindMate.View.MapControls; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using MindMate.View.MapControls; using System.Drawing; using System.Drawing.Drawing2D; -using MindMate.Serialization; -using System.Drawing.Imaging; +using System.Linq; namespace MindMate.Model { @@ -38,10 +36,7 @@ public partial class MapNode [Serialized(Order = 1)] public string Text { - get - { - return text; - } + get => text; set { object oldValue = text; @@ -56,20 +51,17 @@ public string Text [Serialized(Order = 4)] public bool Folded { - get - { - return folded; - } + get => folded; set { if (folded == value) return; //if folding, ensure no selected descendent nodes - if (value == true && (Tree.SelectedNodes.Count > 1 || Tree.SelectedNodes.First != this)) + if (value == true && (Tree.SelectedNodes.Count > 1 || Tree.SelectedNodes.First != this)) { //find selected nodes descendent of 'this' and deselect them - var toUnselect = Tree.SelectedNodes.Where(sNode => sNode.IsDescendent(this)).ToList(); - toUnselect.ForEach(sNode => sNode.Selected = false); + var toUnselect = Tree.SelectedNodes.Where(sNode => sNode.IsDescendent(this)).ToList(); + toUnselect.ForEach(sNode => sNode.Selected = false); } folded = value; @@ -82,10 +74,7 @@ public bool Folded [Serialized(Order = 5)] public string Link { - get - { - return link; - } + get => link; set { object oldValue = link; @@ -103,24 +92,15 @@ public string Link [Serialized(Order = 7)] public DateTime Modified { - get - { - return modified; - } - set - { - modified = value; - } + get => modified; + set => modified = value; } private bool bold; [Serialized(Order = 8)] public bool Bold { - get - { - return bold; - } + get => bold; set { if (bold == value) return; @@ -135,10 +115,7 @@ public bool Bold [Serialized(Order = 9)] public bool Italic { - get - { - return italic; - } + get => italic; set { if (italic == value) return; @@ -153,7 +130,7 @@ public bool Italic [Serialized(Order = 10)] public bool Strikeout { - get { return strikeout; } + get => strikeout; set { if (strikeout == value) return; @@ -166,11 +143,9 @@ public bool Strikeout private string fontName; [Serialized(Order = 11)] - public string FontName { - get - { - return fontName; - } + public string FontName + { + get => fontName; set { object oldValue = fontName; @@ -188,10 +163,7 @@ public string FontName { [Serialized(Order = 12)] public float FontSize { - get - { - return fontSize; - } + get => fontSize; set { object oldValue = fontSize; @@ -209,10 +181,7 @@ public float FontSize [Serialized(Order = 13)] public Color BackColor { - get - { - return backColor; - } + get => backColor; set { object oldValue = backColor; @@ -230,10 +199,7 @@ public Color BackColor [Serialized(Order = 14)] public Color Color { - get - { - return color; - } + get => color; set { object oldValue = color; @@ -248,10 +214,7 @@ public Color Color [Serialized(Order = 15)] public NodeShape Shape { - get - { - return shape; - } + get => shape; set { object oldValue = shape; @@ -269,10 +232,7 @@ public NodeShape Shape [Serialized(Order = 16)] public int LineWidth { - get - { - return lineWidth; - } + get => lineWidth; set { object oldValue = lineWidth; @@ -290,10 +250,7 @@ public int LineWidth [Serialized(Order = 17)] public System.Drawing.Drawing2D.DashStyle LinePattern { - get - { - return linePattern; - } + get => linePattern; set { object oldValue = linePattern; @@ -308,10 +265,7 @@ public System.Drawing.Drawing2D.DashStyle LinePattern [Serialized(Order = 18)] public Color LineColor { - get - { - return lineColor; - } + get => lineColor; set { object oldValue = lineColor; @@ -326,10 +280,7 @@ public Color LineColor [Serialized(Order = 19)] public string NoteText { - get - { - return noteText; - } + get => noteText; set { object oldValue = noteText; @@ -343,14 +294,14 @@ public string NoteText [Serialized(Order = 20)] public string Image { - get { return props?.Image; } + get => props?.Image; set { InitializeProps(); string oldValue = props.Image; props.Image = value; modified = DateTime.Now; - Tree.FireEvent(this, NodeProperties.Image, oldValue); + Tree.FireEvent(this, NodeProperties.Image, oldValue); } } public bool HasImage => props?.Image != null; @@ -362,14 +313,14 @@ public string Image [Serialized(Order = 21)] public ImageAlignment ImageAlignment { - get { return props == null? ImageAlignment.Default : props.ImageAlignment; } + get => props == null ? ImageAlignment.Default : props.ImageAlignment; set { InitializeProps(); ImageAlignment oldValue = props.ImageAlignment; props.ImageAlignment = value; modified = DateTime.Now; - Tree.FireEvent(this, NodeProperties.ImageAlignment, oldValue); + Tree.FireEvent(this, NodeProperties.ImageAlignment, oldValue); } } public bool HasImageAlignment => props != null && props.ImageAlignment != ImageAlignment.Default; @@ -377,7 +328,7 @@ public ImageAlignment ImageAlignment [Serialized(Order =22)] public Size ImageSize { - get { return props == null ? Size.Empty : props.ImageSize; } + get => props == null ? Size.Empty : props.ImageSize; set { InitializeProps(); @@ -393,13 +344,13 @@ public Size ImageSize [Serialized(Order = 23)] public string Label { - get { return label; } + get => label; set { string oldValue = Label; label = value; modified = DateTime.Now; - Tree.FireEvent(this,NodeProperties.Label, oldValue); + Tree.FireEvent(this, NodeProperties.Label, oldValue); } } public bool HasLabel => label != null; @@ -1662,7 +1613,7 @@ public void SetImageAlignment(ImageAlign align) public bool Selected { - get { return Tree.SelectedNodes.Contains(this); } + get => Tree.SelectedNodes.Contains(this); set { if (value) @@ -1696,8 +1647,8 @@ public override string ToString() public NodeView NodeView { - get { return nodeView; } - set { nodeView = value; } + get => nodeView; + set => nodeView = value; } #endregion diff --git a/MindMate/Model/MapTree.cs b/MindMate/Model/MapTree.cs index e6c992d4..57d48717 100644 --- a/MindMate/Model/MapTree.cs +++ b/MindMate/Model/MapTree.cs @@ -3,11 +3,11 @@ * This software is licensed under MIT (see LICENSE.txt) */ +using MindMate.Modules.Undo; using System; using System.Collections.Generic; using System.Drawing; using System.Linq; -using MindMate.Modules.Undo; namespace MindMate.Model { @@ -23,14 +23,8 @@ public MapTree() private MapNode rootNode; public MapNode RootNode { - get - { - return rootNode; - } - set - { - rootNode = value; - } + get => rootNode; + set => rootNode = value; } #region Selected Nodes diff --git a/MindMate/Plugins/MenuItem.cs b/MindMate/Plugins/MenuItem.cs index c1932f51..bccf6793 100644 --- a/MindMate/Plugins/MenuItem.cs +++ b/MindMate/Plugins/MenuItem.cs @@ -1,9 +1,6 @@ using MindMate.Model; using System; -using System.Collections.Generic; using System.Drawing; -using System.Linq; -using System.Text; using System.Windows.Forms; namespace MindMate.Plugins @@ -13,10 +10,7 @@ public class MenuItem private ToolStripMenuItem underlyingMenuItem; public ToolStripMenuItem UnderlyingMenuItem { - get - { - return underlyingMenuItem; - } + get => underlyingMenuItem; private set { @@ -90,28 +84,16 @@ public void AddDropDownItemSeparator() UnderlyingMenuItem.DropDownItems.Add(new ToolStripSeparator()); } - public bool Enabled + public bool Enabled { - get - { - return UnderlyingMenuItem.Enabled; - } - set - { - UnderlyingMenuItem.Enabled = value; - } + get => UnderlyingMenuItem.Enabled; + set => UnderlyingMenuItem.Enabled = value; } public bool Visible { - get - { - return UnderlyingMenuItem.Visible; - } - set - { - UnderlyingMenuItem.Visible = value; - } + get => UnderlyingMenuItem.Visible; + set => UnderlyingMenuItem.Visible = value; } } } diff --git a/MindMate/Plugins/Tasks/DateTimePicker.cs b/MindMate/Plugins/Tasks/DateTimePicker.cs index d03834ab..92ae3386 100644 --- a/MindMate/Plugins/Tasks/DateTimePicker.cs +++ b/MindMate/Plugins/Tasks/DateTimePicker.cs @@ -1,10 +1,4 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; using System.Windows.Forms; namespace MindMate.Plugins.Tasks @@ -18,11 +12,8 @@ public DateTimePicker() public DateTime Value { - get - { - return new DateTime(datePicker.SelectionStart.Year, datePicker.SelectionStart.Month, datePicker.SelectionStart.Day, + get => new DateTime(datePicker.SelectionStart.Year, datePicker.SelectionStart.Month, datePicker.SelectionStart.Day, timePicker.Value.Hour, timePicker.Value.Minute, timePicker.Value.Second); - } set { datePicker.SelectionStart = value; diff --git a/MindMate/Plugins/Tasks/SideBar/CollapsiblePanel.cs b/MindMate/Plugins/Tasks/SideBar/CollapsiblePanel.cs index 112432a5..e05159fb 100644 --- a/MindMate/Plugins/Tasks/SideBar/CollapsiblePanel.cs +++ b/MindMate/Plugins/Tasks/SideBar/CollapsiblePanel.cs @@ -1,11 +1,8 @@ using System; -using System.Collections.Generic; using System.ComponentModel; using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; using System.Drawing.Drawing2D; +using System.Windows.Forms; //using MindMate.Plugins.Tasks.Properties; namespace MindMate.Plugins.Tasks.SideBar @@ -39,15 +36,8 @@ public partial class CollapsiblePanel : Panel [Browsable(false)] public new Color BackColor { - get - { - return Color.Transparent; - - } - set - { - base.BackColor = Color.Transparent; - } + get => Color.Transparent; + set => base.BackColor = Color.Transparent; } [DefaultValue(false)] @@ -55,8 +45,8 @@ public partial class CollapsiblePanel : Panel [Category("CollapsiblePanel")] public bool Collapse { - get { return collapse; } - set + get => collapse; + set { // If using animation make sure to ignore requests for collapse or expand while a previous // operation is in progress. @@ -79,14 +69,11 @@ public bool Collapse [Description("Specifies the speed (in ms) of Expand/Collapse operation when using animation. UseAnimation property must be set to true.")] public int AnimationInterval { - get - { - return timerAnimation.Interval ; - } + get => timerAnimation.Interval; set { // Update animation interval only during idle times. - if(!timerAnimation.Enabled ) + if (!timerAnimation.Enabled) timerAnimation.Interval = value; } } @@ -96,8 +83,8 @@ public int AnimationInterval [Description("Indicate if the panel uses amination during Expand/Collapse operation")] public bool UseAnimation { - get { return useAnimation; } - set { useAnimation = value; } + get => useAnimation; + set => useAnimation = value; } [DefaultValue(true)] @@ -105,7 +92,7 @@ public bool UseAnimation [Description("When set to true draws panel borders, and shows a line separating the panel's header from the rest of the control")] public bool ShowHeaderSeparator { - get { return showHeaderSeparator; } + get => showHeaderSeparator; set { showHeaderSeparator = value; @@ -118,10 +105,7 @@ public bool ShowHeaderSeparator [Description("When set to true, draws a panel with rounded top corners, the radius can bet set through HeaderCornersRadius property")] public bool RoundedCorners { - get - { - return roundedCorners; - } + get => roundedCorners; set { roundedCorners = value; @@ -135,10 +119,7 @@ public bool RoundedCorners [Description("Top corners radius, it should be in [1, 15] range")] public int HeaderCornersRadius { - get - { - return headerCornersRadius; - } + get => headerCornersRadius; set { @@ -159,7 +140,7 @@ public int HeaderCornersRadius [Description("Enables the automatic handling of text that extends beyond the width of the label control.")] public bool HeaderTextAutoEllipsis { - get { return headerTextAutoEllipsis; } + get => headerTextAutoEllipsis; set { headerTextAutoEllipsis = value; @@ -171,7 +152,7 @@ public bool HeaderTextAutoEllipsis [Description("Text to show in panel's header")] public string HeaderText { - get { return headerText; } + get => headerText; set { headerText = value; @@ -183,7 +164,7 @@ public string HeaderText [Description("Color of text header, and panel's borders when ShowHeaderSeparator is set to true")] public Color HeaderTextColor { - get { return headerTextColor; } + get => headerTextColor; set { headerTextColor = value; @@ -196,7 +177,7 @@ public Color HeaderTextColor [Description("Image that will be displayed in the top left corner of the panel")] public Image HeaderImage { - get { return headerImage; } + get => headerImage; set { headerImage = value; @@ -209,7 +190,7 @@ public Image HeaderImage [Description("The font used to display text in the panel's header.")] public Font HeaderFont { - get { return headerFont; } + get => headerFont; set { headerFont = value; diff --git a/MindMate/Plugins/Tasks/SideBar/ControlGroup.cs b/MindMate/Plugins/Tasks/SideBar/ControlGroup.cs index d23c8794..931911ad 100644 --- a/MindMate/Plugins/Tasks/SideBar/ControlGroup.cs +++ b/MindMate/Plugins/Tasks/SideBar/ControlGroup.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Windows.Forms; namespace MindMate.Plugins.Tasks.SideBar @@ -32,26 +30,14 @@ public ControlGroup() public new event ControlEventHandler ControlAdded { - add - { - Table.ControlAdded += value; - } - remove - { - Table.ControlAdded -= value; - } + add => Table.ControlAdded += value; + remove => Table.ControlAdded -= value; } public new event ControlEventHandler ControlRemoved { - add - { - Table.ControlRemoved += value; - } - remove - { - Table.ControlRemoved -= value; - } + add => Table.ControlRemoved += value; + remove => Table.ControlRemoved -= value; } private void AdjustHeightOnAdd(Control item) @@ -105,14 +91,8 @@ public void Insert(int index, Control item) public Control this[int index] { - get - { - return (Control)Table.GetControlFromPosition(0, index); - } - set - { - Insert(index, value); - } + get => (Control)Table.GetControlFromPosition(0, index); + set => Insert(index, value); } public IEnumerator GetEnumerator() diff --git a/MindMate/Plugins/Tasks/SideBar/ControlGroupCollection.cs b/MindMate/Plugins/Tasks/SideBar/ControlGroupCollection.cs index 04670470..138db678 100644 --- a/MindMate/Plugins/Tasks/SideBar/ControlGroupCollection.cs +++ b/MindMate/Plugins/Tasks/SideBar/ControlGroupCollection.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; using System.Windows.Forms; namespace MindMate.Plugins.Tasks.SideBar @@ -99,15 +96,15 @@ public ControlGroup this[int index] { ControlGroup ctrlGroup = (ControlGroup)Table.GetControlFromPosition(0, index); - if(ctrlGroup == null) + if (ctrlGroup == null) { ctrlGroup = (ControlGroup)Table.Controls[index]; - if(Table.GetRow(ctrlGroup) != index) + if (Table.GetRow(ctrlGroup) != index) { - foreach(Control c in Table.Controls) + foreach (Control c in Table.Controls) { - if(Table.GetRow(c) == index) + if (Table.GetRow(c) == index) { ctrlGroup = (ControlGroup)c; break; @@ -118,10 +115,7 @@ public ControlGroup this[int index] return ctrlGroup; } - set - { - Insert(index, value); - } + set => Insert(index, value); } public IEnumerator GetEnumerator() diff --git a/MindMate/Plugins/Tasks/TaskList/TaskView.cs b/MindMate/Plugins/Tasks/TaskList/TaskView.cs index 59b7001e..ac62fc60 100644 --- a/MindMate/Plugins/Tasks/TaskList/TaskView.cs +++ b/MindMate/Plugins/Tasks/TaskList/TaskView.cs @@ -1,13 +1,8 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; +using MindMate.Model; +using MindMate.Plugins.Tasks.Model; +using System; using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; using System.Windows.Forms; -using MindMate.Model; -using MindMate.Plugins.Tasks.Model; namespace MindMate.Plugins.Tasks { @@ -65,50 +60,26 @@ public void SetQuickActionsVisiblity(bool visible) public string TaskTitle { - get - { - return this.lblNodeName.Text; - } - set - { - this.lblNodeName.Text = value; - } + get => this.lblNodeName.Text; + set => this.lblNodeName.Text = value; } public string TaskPath { - get - { - return this.lblTaskPath.Text; - } - set - { - this.lblTaskPath.Text = value; - } + get => this.lblTaskPath.Text; + set => this.lblTaskPath.Text = value; } public string TaskDueOnText { - get - { - return this.lblDueOn.Text; - } - set - { - this.lblDueOn.Text = value; - } + get => this.lblDueOn.Text; + set => this.lblDueOn.Text = value; } public MapNode MapNode { - get - { - return (MapNode)this.Tag; - } - set - { - this.Tag = value; - } + get => (MapNode)this.Tag; + set => this.Tag = value; } public DateTime DueDate => MapNode.GetDueDate(); @@ -185,17 +156,15 @@ private void TaskView_MouseUp(object sender, MouseEventArgs e) public enum TaskViewEvent { Remove, Edit, Complete, Expedite, Defer, Today, Tomorrow, NextWeek, NextMonth, NextQuarter, Select } - public bool Selected { - get + public bool Selected + { + get => BackColor == Color.AliceBlue; + set { - return BackColor == Color.AliceBlue; - } - set - { - if(value) + if (value) BackColor = Color.AliceBlue; else - BackColor = SystemColors.ControlLight; + BackColor = SystemColors.ControlLight; } } diff --git a/MindMate/Serialization/PersistenceManager.cs b/MindMate/Serialization/PersistenceManager.cs index 242875e7..b64a74eb 100644 --- a/MindMate/Serialization/PersistenceManager.cs +++ b/MindMate/Serialization/PersistenceManager.cs @@ -1,8 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Linq; -using System.Text; namespace MindMate.Serialization { @@ -67,10 +65,7 @@ public PersistentTree Find(System.Predicate match) private PersistentTree currentTree; public PersistentTree CurrentTree { - get - { - return currentTree; - } + get => currentTree; set { if (currentTree == value) return; diff --git a/MindMate/Serialization/PersistentTree.cs b/MindMate/Serialization/PersistentTree.cs index 34934bca..f0702639 100644 --- a/MindMate/Serialization/PersistentTree.cs +++ b/MindMate/Serialization/PersistentTree.cs @@ -1,12 +1,9 @@ using MindMate.Model; using System; -using System.Collections; using System.Collections.Generic; -using System.Collections.Specialized; using System.Diagnostics; using System.IO; using System.Linq; -using System.Text; namespace MindMate.Serialization { @@ -64,17 +61,14 @@ internal void Initialize(string fileName) private bool isDirty; public bool IsDirty { - get - { - return isDirty; - } + get => isDirty; set { if (isDirty == value) return; isDirty = !isDirty; DirtyChanged?.Invoke(this); } - + } /// diff --git a/MindMate/View/Dialogs/InputBox.cs b/MindMate/View/Dialogs/InputBox.cs index 12dddc53..e77118d0 100644 --- a/MindMate/View/Dialogs/InputBox.cs +++ b/MindMate/View/Dialogs/InputBox.cs @@ -3,13 +3,6 @@ * This software is licensed under MIT (see LICENSE.txt) */ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; using System.Windows.Forms; namespace MindMate.View.Dialogs @@ -25,15 +18,9 @@ public InputBox(string question, string caption = null) public string Answer { - get - { - return txtAnswer.Text; - } - set - { - txtAnswer.Text = value; - } + get => txtAnswer.Text; + set => txtAnswer.Text = value; } - + } } diff --git a/MindMate/View/Dialogs/LinkManualEdit.cs b/MindMate/View/Dialogs/LinkManualEdit.cs index 9c724919..412f4d8f 100644 --- a/MindMate/View/Dialogs/LinkManualEdit.cs +++ b/MindMate/View/Dialogs/LinkManualEdit.cs @@ -3,13 +3,6 @@ * This software is licensed under MIT (see LICENSE.txt) */ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; using System.Windows.Forms; namespace MindMate.View.Dialogs @@ -23,14 +16,8 @@ public LinkManualEdit() public string LinkText { - get - { - return textBox1.Text; - } - set - { - textBox1.Text = value; - } + get => textBox1.Text; + set => textBox1.Text = value; } } } diff --git a/MindMate/View/EditorTabs/EditorTabs.cs b/MindMate/View/EditorTabs/EditorTabs.cs index c9836bb5..c938864b 100644 --- a/MindMate/View/EditorTabs/EditorTabs.cs +++ b/MindMate/View/EditorTabs/EditorTabs.cs @@ -1,12 +1,7 @@ -using MindMate.Controller; -using MindMate.Model; -using MindMate.Serialization; +using MindMate.Serialization; using MindMate.View.MapControls; using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; -using System.Text; using System.Windows.Forms; namespace MindMate.View.EditorTabs @@ -40,8 +35,8 @@ private void ShowHeader() public new TabBase SelectedTab { - get { return (TabBase)base.SelectedTab; } - set { base.SelectedTab = value; } + get => (TabBase)base.SelectedTab; + set => base.SelectedTab = value; } /// diff --git a/MindMate/View/MapControls/IconView.cs b/MindMate/View/MapControls/IconView.cs index 25066656..bce87829 100644 --- a/MindMate/View/MapControls/IconView.cs +++ b/MindMate/View/MapControls/IconView.cs @@ -3,12 +3,8 @@ * This software is licensed under MIT (see LICENSE.txt) */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; using MindMate.MetaModel; +using System.Drawing; namespace MindMate.View.MapControls { @@ -32,8 +28,8 @@ public IconView(IIcon iIcon) public PointF Location { - get { return location; } - set { location = value; } + get => location; + set => location = value; } diff --git a/MindMate/View/MapControls/Link.cs b/MindMate/View/MapControls/Link.cs index 085c6861..98d85c43 100644 --- a/MindMate/View/MapControls/Link.cs +++ b/MindMate/View/MapControls/Link.cs @@ -3,12 +3,8 @@ * This software is licensed under MIT (see LICENSE.txt) */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; using MindMate.Model; +using System.Drawing; namespace MindMate.View.MapControls { @@ -57,16 +53,16 @@ public void ChangeLink(string link, NodeLinkType linkType) public NodeLinkType LinkType { - get { return linkType; } - set { linkType = value; } + get => linkType; + set => linkType = value; } PointF location; public PointF Location { - get { return location; } - set { location = value; } + get => location; + set => location = value; } diff --git a/MindMate/View/MapControls/MapViewTextEditor.cs b/MindMate/View/MapControls/MapViewTextEditor.cs index 49510bbc..4b77b0cc 100644 --- a/MindMate/View/MapControls/MapViewTextEditor.cs +++ b/MindMate/View/MapControls/MapViewTextEditor.cs @@ -5,10 +5,7 @@ using MindMate.Model; using System; -using System.Collections.Generic; using System.Drawing; -using System.Linq; -using System.Text; using System.Windows.Forms; namespace MindMate.View.MapControls @@ -92,20 +89,14 @@ private void editBoxKeyDown(object sender, KeyEventArgs e) public bool Enabled { - get { return enabled; } - set { enabled = value; } + get => enabled; + set => enabled = value; } public ContextMenuStrip ContextMenu { - get - { - return editBox.ContextMenuStrip; - } - set - { - editBox.ContextMenuStrip = value; - } + get => editBox.ContextMenuStrip; + set => editBox.ContextMenuStrip = value; } public void BeginNodeEdit(NodeView nView, TextCursorPosition org) diff --git a/MindMate/View/MapControls/NoteIcon.cs b/MindMate/View/MapControls/NoteIcon.cs index c40d40e9..654bd716 100644 --- a/MindMate/View/MapControls/NoteIcon.cs +++ b/MindMate/View/MapControls/NoteIcon.cs @@ -3,10 +3,6 @@ * This software is licensed under MIT (see LICENSE.txt) */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Drawing; namespace MindMate.View.MapControls @@ -23,8 +19,8 @@ public NoteIcon() public PointF Location { - get { return location; } - set { location = value; } + get => location; + set => location = value; } diff --git a/MindMate/View/NoteEditing/HtmlSourceDialog.cs b/MindMate/View/NoteEditing/HtmlSourceDialog.cs index ffa138f0..1d05759f 100644 --- a/MindMate/View/NoteEditing/HtmlSourceDialog.cs +++ b/MindMate/View/NoteEditing/HtmlSourceDialog.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; +using System.Windows.Forms; namespace MindMate.View.NoteEditing { @@ -19,14 +12,8 @@ public HtmlSourceDialog() public string HtmlSource { - get - { - return txtSource.Text; - } - set - { - txtSource.Text = value; - } + get => txtSource.Text; + set => txtSource.Text = value; } } } diff --git a/MindMate/View/NoteEditing/MsHtmlWrap/HtmlEditorException.cs b/MindMate/View/NoteEditing/MsHtmlWrap/HtmlEditorException.cs index c6e47be7..9ec97248 100644 --- a/MindMate/View/NoteEditing/MsHtmlWrap/HtmlEditorException.cs +++ b/MindMate/View/NoteEditing/MsHtmlWrap/HtmlEditorException.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace MindMate.View.NoteEditing.MsHtmlWrap { @@ -13,14 +10,8 @@ public class HtmlEditorException : ApplicationException // property for the operation name public string Operation { - get - { - return _operationName; - } - set - { - _operationName = value; - } + get => _operationName; + set => _operationName = value; } //OperationName diff --git a/MindMate/View/NoteEditing/MsHtmlWrap/MarkupPointer.cs b/MindMate/View/NoteEditing/MsHtmlWrap/MarkupPointer.cs index a9a7fc8e..ecd2e9d9 100644 --- a/MindMate/View/NoteEditing/MsHtmlWrap/MarkupPointer.cs +++ b/MindMate/View/NoteEditing/MsHtmlWrap/MarkupPointer.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections; -using System.Globalization; -using System.Text; -using mshtml; +using mshtml; +using System; namespace MindMate.View.NoteEditing.MsHtmlWrap { @@ -34,12 +31,9 @@ public bool Cling PointerRaw.Cling(out b); return b; } - set - { - PointerRaw.SetCling(value); - } + set => PointerRaw.SetCling(value); } - + /// /// Retrieves the IHTMLElement positioned in this pointer. /// @@ -81,10 +75,7 @@ public _POINTER_GRAVITY Gravity PointerRaw.Gravity(out gravity); return gravity; } - set - { - PointerRaw.SetGravity(value); - } + set => PointerRaw.SetGravity(value); } /// diff --git a/MindMate/View/NoteEditing/NoteEditor.cs b/MindMate/View/NoteEditing/NoteEditor.cs index 3664615b..bab02b06 100644 --- a/MindMate/View/NoteEditing/NoteEditor.cs +++ b/MindMate/View/NoteEditing/NoteEditor.cs @@ -1,16 +1,10 @@ -using System; -using System.Collections.Generic; +using MindMate.View.NoteEditing.MsHtmlWrap; +using mshtml; +using System; using System.ComponentModel; using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using mshtml; using System.Runtime.InteropServices; -using MindMate.View.NoteEditing.MsHtmlWrap; -using System.Text.RegularExpressions; -using MindMate.Modules.Logging; +using System.Windows.Forms; using Convert = MindMate.Serialization.Convert; namespace MindMate.View.NoteEditing @@ -135,10 +129,7 @@ internal void _FireCursorMovedEvent() /// public override Color BackColor { - get - { - return base.BackColor; - } + get => base.BackColor; set { base.BackColor = value; @@ -148,7 +139,7 @@ public override Color BackColor } } } - + /// /// Get/Set the foreground color of the editor. /// Note that if this is called before the document is rendered and @@ -198,13 +189,13 @@ private void this_GotFocus(object sender, EventArgs e) /// public string HTML { - get { return this.Document.Body.InnerHtml; } - set + get => this.Document.Body.InnerHtml; + set { Dirty = false; if (this.Document.Body.InnerHtml == null && value == null) return; //should not set ignore dirty flag in this case ignoreDirtyNotification = true; - this.Document.Body.InnerHtml = value; + this.Document.Body.InnerHtml = value; CursorMoved?.Invoke(this); } } @@ -221,8 +212,8 @@ public void UpdateHtmlSource(string html) public new bool Enabled { - get { return ((Control)this).Enabled; } - set { ((Control)this).Enabled = value; } + get => ((Control)this).Enabled; + set => ((Control)this).Enabled = value; } /// diff --git a/MindMate/View/NoteEditing/PluggableProtocol/ProtocolBase.cs b/MindMate/View/NoteEditing/PluggableProtocol/ProtocolBase.cs index f4dc9291..5c71ee64 100644 --- a/MindMate/View/NoteEditing/PluggableProtocol/ProtocolBase.cs +++ b/MindMate/View/NoteEditing/PluggableProtocol/ProtocolBase.cs @@ -1,6 +1,5 @@ using System; using System.Diagnostics; -using System.IO; using System.Runtime.InteropServices; namespace MindMate.View.NoteEditing.PluggableProtocol @@ -87,10 +86,7 @@ public static BINDINFO GetBindInfo(IInternetBindInfo pOIBindInfo) private byte[] data; protected byte[] Data { - get - { - return data; - } + get => data; set { diff --git a/MindMate/View/NoteEditing/TablePropertyForm.cs b/MindMate/View/NoteEditing/TablePropertyForm.cs index 902b6386..9d684aa0 100644 --- a/MindMate/View/NoteEditing/TablePropertyForm.cs +++ b/MindMate/View/NoteEditing/TablePropertyForm.cs @@ -1,9 +1,4 @@ using System; -using System.Drawing; -using System.Drawing.Text; -using System.Collections; -using System.ComponentModel; -using System.Windows.Forms; namespace MindMate.View.NoteEditing { @@ -151,14 +146,8 @@ private void MeasurementOptionChanged(object sender, System.EventArgs e) public bool UpdateTable { - get - { - return !bInsert.Text.Equals("Insert"); - } - set - { - bInsert.Text = value ? "Update" : "Insert"; - } + get => !bInsert.Text.Equals("Insert"); + set => bInsert.Text = value ? "Update" : "Insert"; } From 1fd5c0f64468c7a49e80414a727a74a66aa90312 Mon Sep 17 00:00:00 2001 From: Lehonti Ramos Date: Tue, 5 Sep 2023 22:35:45 +0200 Subject: [PATCH 4/5] Sealed classes in `NodeChangedEventArgs.cs` --- MindMate/Model/NodeChangedEventArgs.cs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/MindMate/Model/NodeChangedEventArgs.cs b/MindMate/Model/NodeChangedEventArgs.cs index e2a05069..0dfb1a32 100644 --- a/MindMate/Model/NodeChangedEventArgs.cs +++ b/MindMate/Model/NodeChangedEventArgs.cs @@ -4,47 +4,44 @@ */ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace MindMate.Model { - public class NodePropertyChangedEventArgs : EventArgs + public sealed class NodePropertyChangedEventArgs : EventArgs { public NodeProperties ChangedProperty { get; set; } public object OldValue { get; set; } } - public class TreeStructureChangedEventArgs : EventArgs + public sealed class TreeStructureChangedEventArgs : EventArgs { public TreeStructureChange ChangeType { get; set; } } - public class IconChangedEventArgs : EventArgs + public sealed class IconChangedEventArgs : EventArgs { public IconChange ChangeType { get; set; } public string Icon { get; set; } } - public class AttributeChangeEventArgs : EventArgs + public sealed class AttributeChangeEventArgs : EventArgs { public AttributeChange ChangeType { get; set; } public MapTree.AttributeSpec AttributeSpec { get; set; } public string oldValue { get; set; } } - public class AttributeChangingEventArgs : EventArgs + public sealed class AttributeChangingEventArgs : EventArgs { public AttributeChange ChangeType { get; set; } public MapTree.AttributeSpec AttributeSpec { get; set; } - public string NewValue { get; set; } + public string NewValue { get; set; } } - public class TreeDefaultFormatChangedEventArgs : EventArgs + public sealed class TreeDefaultFormatChangedEventArgs : EventArgs { public TreeFormatChange ChangeType { get; set; } - public object OldValue { get; set; } + public object OldValue { get; set; } } } From a37d33a3d4b919bcb7a01d146431e30ed9449e53 Mon Sep 17 00:00:00 2001 From: Lehonti Ramos Date: Tue, 5 Sep 2023 22:39:32 +0200 Subject: [PATCH 5/5] Removed unnecessary variable in `ImageHelper.GetExtension` --- MindMate/Model/ImageHelper.cs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/MindMate/Model/ImageHelper.cs b/MindMate/Model/ImageHelper.cs index b66c2971..f00e5748 100644 --- a/MindMate/Model/ImageHelper.cs +++ b/MindMate/Model/ImageHelper.cs @@ -1,33 +1,26 @@ using MindMate.Modules.Logging; using System; -using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace MindMate.Model { public static class ImageHelper { public static string GetExtension(Image image) - { - string ext; + { if (image.RawFormat.Equals(ImageFormat.Bmp)) - ext = "bmp"; + return "bmp"; else if (image.RawFormat.Equals(ImageFormat.Gif)) - ext = "gif"; + return "gif"; else if (image.RawFormat.Equals(ImageFormat.Icon)) - ext = "ico"; + return "ico"; else if (image.RawFormat.Equals(ImageFormat.Jpeg)) - ext = "jpg"; + return "jpg"; else if (image.RawFormat.Equals(ImageFormat.Tiff)) - ext = "tiff"; + return "tiff"; else - ext = "png"; - - return ext; + return "png"; } public const int IMAGE_DEFAULT_MAX_HEIGHT = 300;