From: Jean-Philippe Bruyère Date: Thu, 4 Jun 2020 17:58:26 +0000 (+0200) Subject: use [CallerMemberName] for value change notify X-Git-Tag: v0.9.5-beta~113^2~14 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=2e0586b573df1d1d1629044ad1b546a8a8c49ab6;p=jp%2Fcrow.git use [CallerMemberName] for value change notify --- diff --git a/Crow/src/Interface.cs b/Crow/src/Interface.cs index 5adf3172..9757e76e 100644 --- a/Crow/src/Interface.cs +++ b/Crow/src/Interface.cs @@ -9,6 +9,7 @@ using System.Globalization; using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; using Crow.Cairo; @@ -45,11 +46,15 @@ namespace Crow { #region IValueChange implementation public event EventHandler ValueChanged; - public virtual void NotifyValueChanged (string MemberName, object _value) + public void NotifyValueChanged (string MemberName, object _value) { //Debug.WriteLine ("Value changed: {0}->{1} = {2}", this, MemberName, _value); ValueChanged.Raise (this, new ValueChangeEventArgs (MemberName, _value)); } + public void NotifyValueChanged (object _value, [CallerMemberName] string caller = null) + { + NotifyValueChanged (caller, _value); + } #endregion internal static List crowAssemblies = new List (); diff --git a/Crow/src/Widgets/Border.cs b/Crow/src/Widgets/Border.cs index cc331e78..e0a9ba5e 100644 --- a/Crow/src/Widgets/Border.cs +++ b/Crow/src/Widgets/Border.cs @@ -43,7 +43,7 @@ namespace Crow if (raisedColor == value) return; raisedColor = value; - NotifyValueChanged ("RaisedColor", raisedColor); + NotifyValueChangedAuto (raisedColor); RegisterForRedraw (); } } @@ -56,7 +56,7 @@ namespace Crow if (sunkenColor == value) return; sunkenColor = value; - NotifyValueChanged ("SunkenColor", sunkenColor); + NotifyValueChangedAuto (sunkenColor); RegisterForRedraw (); } } diff --git a/Crow/src/Widgets/Button.cs b/Crow/src/Widgets/Button.cs index 6d997a23..db83d4b2 100644 --- a/Crow/src/Widgets/Button.cs +++ b/Crow/src/Widgets/Button.cs @@ -29,18 +29,12 @@ namespace Crow IsPressed = true; base.onMouseDown (sender, e); - - //TODO:remove - NotifyValueChanged ("State", "pressed"); } public override void onMouseUp (object sender, MouseButtonEventArgs e) { IsPressed = false; base.onMouseUp (sender, e); - - //TODO:remove - NotifyValueChanged ("State", "normal"); } #endregion @@ -51,7 +45,7 @@ namespace Crow if (image == value) return; image = value; - NotifyValueChanged ("Image", image); + NotifyValueChangedAuto (image); } } [DefaultValue(false)] @@ -65,7 +59,7 @@ namespace Crow isPressed = value; - NotifyValueChanged ("IsPressed", isPressed); + NotifyValueChangedAuto (isPressed); if (isPressed) Pressed.Raise (this, null); diff --git a/Crow/src/Widgets/CheckBox.cs b/Crow/src/Widgets/CheckBox.cs index 50215241..cd0297f7 100644 --- a/Crow/src/Widgets/CheckBox.cs +++ b/Crow/src/Widgets/CheckBox.cs @@ -34,7 +34,7 @@ namespace Crow isChecked = value; - NotifyValueChanged ("IsChecked", value); + NotifyValueChangedAuto (isChecked); if (isChecked) Checked.Raise (this, null); diff --git a/Crow/src/Widgets/ColorPicker.cs b/Crow/src/Widgets/ColorPicker.cs index c62659a0..4f5c0539 100644 --- a/Crow/src/Widgets/ColorPicker.cs +++ b/Crow/src/Widgets/ColorPicker.cs @@ -29,7 +29,7 @@ namespace Crow if (currentColor.Equals(value)) return; currentColor = value; - NotifyValueChanged ("CurrentColor", currentColor); + NotifyValueChangedAuto (currentColor); NotifyValueChanged ("CurrentColor2", Color.FromHSV (currentColor.Hue, currentColor.Value, currentColor.Saturation, currentColor.A)); } } diff --git a/Crow/src/Widgets/ColorSlider.cs b/Crow/src/Widgets/ColorSlider.cs index 1e4029dc..52e7e620 100644 --- a/Crow/src/Widgets/ColorSlider.cs +++ b/Crow/src/Widgets/ColorSlider.cs @@ -34,7 +34,7 @@ namespace Crow if (orientation == value) return; orientation = value; - NotifyValueChanged ("Orientation", orientation); + NotifyValueChangedAuto (orientation); RegisterForGraphicUpdate (); } } @@ -45,7 +45,7 @@ namespace Crow if (cursorType == value) return; cursorType = value; - NotifyValueChanged ("CursorType", cursorType); + NotifyValueChangedAuto (cursorType); RegisterForRedraw (); } } @@ -56,7 +56,7 @@ namespace Crow if (component == value) return; component = value; - NotifyValueChanged ("Component", component); + NotifyValueChangedAuto (component); RegisterForRedraw (); } } @@ -68,7 +68,7 @@ namespace Crow currentColor = value; - NotifyValueChanged ("CurrentColor", currentColor); + NotifyValueChangedAuto (currentColor); RegisterForRedraw (); switch (component) { diff --git a/Crow/src/Widgets/ComboBox.cs b/Crow/src/Widgets/ComboBox.cs index cf706318..22672645 100644 --- a/Crow/src/Widgets/ComboBox.cs +++ b/Crow/src/Widgets/ComboBox.cs @@ -19,7 +19,7 @@ namespace Crow get { return minimumPopupSize; } set { minimumPopupSize = value; - NotifyValueChanged ("MinimumPopupSize", minimumPopupSize); + NotifyValueChangedAuto (minimumPopupSize); } } diff --git a/Crow/src/Widgets/DirectoryView.cs b/Crow/src/Widgets/DirectoryView.cs index 8768d65f..89f388d1 100644 --- a/Crow/src/Widgets/DirectoryView.cs +++ b/Crow/src/Widgets/DirectoryView.cs @@ -37,7 +37,7 @@ namespace Crow if (value == _selectedItem) return; _selectedItem = value; - NotifyValueChanged ("SelectedItem", _selectedItem); + NotifyValueChangedAuto (_selectedItem); } } [DefaultValue(true)] @@ -47,7 +47,7 @@ namespace Crow if (showFiles == value) return; showFiles = value; - NotifyValueChanged ("ShowFiles", showFiles); + NotifyValueChangedAuto (showFiles); NotifyValueChanged ("FileSystemEntries", FileSystemEntries); } } @@ -58,7 +58,7 @@ namespace Crow if (showHidden == value) return; showHidden = value; - NotifyValueChanged ("ShowHidden", showHidden); + NotifyValueChangedAuto (showHidden); NotifyValueChanged ("FileSystemEntries", FileSystemEntries); } } @@ -69,7 +69,7 @@ namespace Crow if (fileMask == value) return; fileMask = value; - NotifyValueChanged ("FileMask", fileMask); + NotifyValueChangedAuto (fileMask); NotifyValueChanged ("FileSystemEntries", FileSystemEntries); } } @@ -80,7 +80,7 @@ namespace Crow if (currentDirectory == value) return; currentDirectory = value; - NotifyValueChanged ("CurrentDirectory", currentDirectory); + NotifyValueChangedAuto (currentDirectory); NotifyValueChanged ("FileSystemEntries", FileSystemEntries); } } diff --git a/Crow/src/Widgets/DockWindow.cs b/Crow/src/Widgets/DockWindow.cs index 1c2f95a5..e9c37179 100644 --- a/Crow/src/Widgets/DockWindow.cs +++ b/Crow/src/Widgets/DockWindow.cs @@ -29,7 +29,7 @@ namespace Crow if (isDocked == value) return; isDocked = value; - NotifyValueChanged ("IsDocked", isDocked); + NotifyValueChangedAuto (isDocked); NotifyValueChanged ("IsFloating", !isDocked); } } @@ -41,7 +41,7 @@ namespace Crow if (docking == value) return; docking = value; - NotifyValueChanged ("DockingPosition", DockingPosition); + NotifyValueChangedAuto (DockingPosition); } } public override bool PointIsIn (ref Point m) diff --git a/Crow/src/Widgets/EnumSelector.cs b/Crow/src/Widgets/EnumSelector.cs index bac4f5f6..7e0fd476 100644 --- a/Crow/src/Widgets/EnumSelector.cs +++ b/Crow/src/Widgets/EnumSelector.cs @@ -49,7 +49,7 @@ namespace Crow return; iconsPrefix = value; forceRefresh (); - NotifyValueChanged ("IconsPrefix", iconsPrefix); + NotifyValueChangedAuto (iconsPrefix); } } [DefaultValue (".svg")] @@ -60,7 +60,7 @@ namespace Crow return; iconsExtension = value; forceRefresh (); - NotifyValueChanged ("IconsExtension", iconsExtension); + NotifyValueChangedAuto (iconsExtension); } } /// @@ -76,7 +76,7 @@ namespace Crow rbStyle = value; radioButtonITor = null; forceRefresh (); - NotifyValueChanged ("RadioButtonStyle", rbStyle); + NotifyValueChangedAuto (rbStyle); } } /// @@ -120,7 +120,7 @@ namespace Crow } else enumValueContainer.ClearChildren (); - NotifyValueChanged ("EnumValue", enumValue); + NotifyValueChangedAuto (enumValue); RegisterForRedraw (); } } diff --git a/Crow/src/Widgets/Expandable.cs b/Crow/src/Widgets/Expandable.cs index 3a480b24..e0b3c72a 100644 --- a/Crow/src/Widgets/Expandable.cs +++ b/Crow/src/Widgets/Expandable.cs @@ -74,7 +74,7 @@ namespace Crow if (image == value) return; image = value; - NotifyValueChanged ("Image", image); + NotifyValueChangedAuto (image); } } [DefaultValue(false)] @@ -93,7 +93,7 @@ namespace Crow if (!isExp) _isExpanded = false; - NotifyValueChanged ("IsExpanded", _isExpanded); + NotifyValueChangedAuto (_isExpanded); if (_isExpanded) onExpand (this, null); diff --git a/Crow/src/Widgets/FileDialog.cs b/Crow/src/Widgets/FileDialog.cs index 4a095e1f..8c58e632 100644 --- a/Crow/src/Widgets/FileDialog.cs +++ b/Crow/src/Widgets/FileDialog.cs @@ -35,7 +35,7 @@ namespace Crow if (curDir == value) return; curDir = value; - NotifyValueChanged ("CurrentDirectory", curDir); + NotifyValueChangedAuto (curDir); SelectedDirectory = curDir; } } @@ -47,7 +47,7 @@ namespace Crow if (searchPattern == value) return; searchPattern = value; - NotifyValueChanged ("SearchPattern", searchPattern); + NotifyValueChangedAuto (searchPattern); } } @@ -58,7 +58,7 @@ namespace Crow if (showHidden == value) return; showHidden = value; - NotifyValueChanged ("ShowHidden", showHidden); + NotifyValueChangedAuto (showHidden); } } [DefaultValue(true)] @@ -68,7 +68,7 @@ namespace Crow if (showFiles == value) return; showFiles = value; - NotifyValueChanged ("ShowFiles", showFiles); + NotifyValueChangedAuto (showFiles); } } public string SelectedFile { @@ -77,7 +77,7 @@ namespace Crow if (value == _selectedFile) return; _selectedFile = value; - NotifyValueChanged ("SelectedFile", _selectedFile); + NotifyValueChangedAuto (_selectedFile); } } public string SelectedDirectory { @@ -86,7 +86,7 @@ namespace Crow if (value == _selectedDir) return; _selectedDir = value; - NotifyValueChanged ("SelectedDirectory", _selectedDir); + NotifyValueChangedAuto (_selectedDir); } } diff --git a/Crow/src/Widgets/GenericStack.cs b/Crow/src/Widgets/GenericStack.cs index a0fb4d0c..f4473252 100644 --- a/Crow/src/Widgets/GenericStack.cs +++ b/Crow/src/Widgets/GenericStack.cs @@ -31,8 +31,8 @@ namespace Crow set { if (_spacing == value) return; - _spacing = value; - NotifyValueChanged ("Spacing", Spacing); + _spacing = value; + NotifyValueChangedAuto (Spacing); RegisterForLayouting (LayoutingType.Sizing|LayoutingType.ArrangeChildren); } } diff --git a/Crow/src/Widgets/Grid.cs b/Crow/src/Widgets/Grid.cs index ad776bd3..56b37f16 100644 --- a/Crow/src/Widgets/Grid.cs +++ b/Crow/src/Widgets/Grid.cs @@ -70,9 +70,9 @@ namespace Crow if (_columnCount == value) return; - _columnCount = value; + _columnCount = value; - NotifyValueChanged ("ColumnCount", ColumnCount); + NotifyValueChangedAuto (ColumnCount); this.RegisterForLayouting (LayoutingType.ArrangeChildren); } } @@ -84,9 +84,9 @@ namespace Crow if (_rowCount == value) return; - _rowCount = value; + _rowCount = value; - NotifyValueChanged ("RowCount", RowCount); + NotifyValueChangedAuto (RowCount); this.RegisterForLayouting (LayoutingType.ArrangeChildren); } } diff --git a/Crow/src/Widgets/HueSelector.cs b/Crow/src/Widgets/HueSelector.cs index 3e761b30..7bf2895c 100644 --- a/Crow/src/Widgets/HueSelector.cs +++ b/Crow/src/Widgets/HueSelector.cs @@ -53,7 +53,7 @@ namespace Crow if (_orientation == value) return; _orientation = value; - NotifyValueChanged ("Orientation", _orientation); + NotifyValueChangedAuto (_orientation); RegisterForGraphicUpdate (); } } diff --git a/Crow/src/Widgets/IMLContainer.cs b/Crow/src/Widgets/IMLContainer.cs index 174ef083..2dd74e7c 100644 --- a/Crow/src/Widgets/IMLContainer.cs +++ b/Crow/src/Widgets/IMLContainer.cs @@ -21,7 +21,7 @@ namespace Crow return; path = value; this.SetChild (IFace.CreateInstance (path)); - NotifyValueChanged ("Path", path); + NotifyValueChangedAuto (path); } } } diff --git a/Crow/src/Widgets/Image.cs b/Crow/src/Widgets/Image.cs index b67c9d70..04cb2e22 100644 --- a/Crow/src/Widgets/Image.cs +++ b/Crow/src/Widgets/Image.cs @@ -34,7 +34,7 @@ namespace Crow if (scaled == value) return; scaled = value; - NotifyValueChanged ("Scaled", scaled); + NotifyValueChangedAuto (scaled); if (_pic == null) return; _pic.Scaled = scaled; @@ -51,7 +51,7 @@ namespace Crow if (keepProps == value) return; keepProps = value; - NotifyValueChanged ("KeepProportions", keepProps); + NotifyValueChangedAuto (keepProps); if (_pic == null) return; _pic.KeepProportions = keepProps; @@ -78,7 +78,7 @@ namespace Crow Debug.WriteLine (ex.Message); _pic = null; } - NotifyValueChanged ("Path", Path); + NotifyValueChangedAuto (Path); } } /// @@ -104,7 +104,7 @@ namespace Crow if (_pic == value) return; _pic = value; - NotifyValueChanged ("Picture", _pic); + NotifyValueChangedAuto (_pic); RegisterForGraphicUpdate (); } } @@ -119,7 +119,7 @@ namespace Crow if (opacity == value) return; opacity = value; - NotifyValueChanged ("Faded", opacity); + NotifyValueChangedAuto (opacity); RegisterForRedraw (); } } diff --git a/Crow/src/Widgets/Label.cs b/Crow/src/Widgets/Label.cs index e500b98f..68541c5f 100644 --- a/Crow/src/Widgets/Label.cs +++ b/Crow/src/Widgets/Label.cs @@ -60,7 +60,7 @@ namespace Crow { if (selBackground == value) return; selBackground = value; - NotifyValueChanged ("SelectionBackground", selBackground); + NotifyValueChangedAuto (selBackground); RegisterForRedraw (); } } @@ -71,7 +71,7 @@ namespace Crow { if (selForeground == value) return; selForeground = value; - NotifyValueChanged ("SelectionForeground", selForeground); + NotifyValueChangedAuto (selForeground); RegisterForRedraw (); } } @@ -84,7 +84,7 @@ namespace Crow { return; _textAlignment = value; RegisterForRedraw (); - NotifyValueChanged ("TextAlignment", _textAlignment); + NotifyValueChangedAuto (_textAlignment); } } [DefaultValue(false)] @@ -95,7 +95,7 @@ namespace Crow { return; horizontalStretch = value; RegisterForRedraw (); - NotifyValueChanged ("HorizontalStretch", horizontalStretch); + NotifyValueChangedAuto (horizontalStretch); } } [DefaultValue(false)] @@ -106,7 +106,7 @@ namespace Crow { return; verticalStretch = value; RegisterForRedraw (); - NotifyValueChanged ("VerticalStretch", verticalStretch); + NotifyValueChangedAuto (verticalStretch); } } [DefaultValue("label")] @@ -141,7 +141,7 @@ namespace Crow { if (value == _selectable) return; _selectable = value; - NotifyValueChanged ("Selectable", _selectable); + NotifyValueChangedAuto (_selectable); SelBegin = -1; SelRelease = -1; RegisterForRedraw (); @@ -156,7 +156,7 @@ namespace Crow { if (value == _multiline) return; _multiline = value; - NotifyValueChanged ("Multiline", _multiline); + NotifyValueChangedAuto (_multiline); RegisterForGraphicUpdate(); } } @@ -172,7 +172,7 @@ namespace Crow { _currentCol = lines [_currentLine].Length; else _currentCol = value; - NotifyValueChanged ("CurrentColumn", _currentCol); + NotifyValueChangedAuto (_currentCol); Rectangle cb = ClientRectangle; @@ -227,7 +227,7 @@ namespace Crow { int cc = _currentCol; _currentCol = 0; CurrentColumn = cc; - NotifyValueChanged ("CurrentLine", _currentLine); + NotifyValueChangedAuto (_currentLine); } } [XmlIgnore]public Point CurrentPosition { @@ -246,7 +246,7 @@ namespace Crow { if (value == _selBegin) return; _selBegin = value; - NotifyValueChanged ("SelBegin", _selBegin); + NotifyValueChangedAuto (_selBegin); NotifyValueChanged ("SelectedText", SelectedText); } } @@ -259,7 +259,7 @@ namespace Crow { if (value == _selRelease) return; _selRelease = value; - NotifyValueChanged ("SelRelease", _selRelease); + NotifyValueChangedAuto (_selRelease); NotifyValueChanged ("SelectedText", SelectedText); } } diff --git a/Crow/src/Widgets/Menu.cs b/Crow/src/Widgets/Menu.cs index 85f5485c..afd40060 100644 --- a/Crow/src/Widgets/Menu.cs +++ b/Crow/src/Widgets/Menu.cs @@ -48,7 +48,7 @@ namespace Crow if (orientation == value) return; orientation = value; - NotifyValueChanged ("Orientation", orientation); + NotifyValueChangedAuto (orientation); } } [XmlIgnore]public bool AutomaticOpening @@ -58,7 +58,7 @@ namespace Crow if (autoOpen == value) return; autoOpen = value; - NotifyValueChanged ("AutomaticOpening", autoOpen); + NotifyValueChangedAuto (autoOpen); } } #endregion diff --git a/Crow/src/Widgets/MenuItem.cs b/Crow/src/Widgets/MenuItem.cs index fe8cfe95..2491c49b 100644 --- a/Crow/src/Widgets/MenuItem.cs +++ b/Crow/src/Widgets/MenuItem.cs @@ -53,7 +53,7 @@ namespace Crow if (isOpened == value) return; isOpened = value; - NotifyValueChanged ("IsOpened", isOpened); + NotifyValueChangedAuto (isOpened); if (isOpened) { onOpen (this, null); @@ -82,7 +82,7 @@ namespace Crow command.raiseAllValuesChanged (); } - NotifyValueChanged ("Command", command); + NotifyValueChangedAuto (command); } } @@ -103,7 +103,7 @@ namespace Crow return; icon = value; if (command == null) - NotifyValueChanged ("Icon", icon); + NotifyValueChangedAuto (icon); } } [DefaultValue("Fit")] @@ -113,7 +113,7 @@ namespace Crow if (popWidth == value) return; popWidth = value; - NotifyValueChanged ("PopWidth", popWidth); + NotifyValueChangedAuto (popWidth); } } [DefaultValue("Fit")] @@ -123,7 +123,7 @@ namespace Crow if (popHeight == value) return; popHeight = value; - NotifyValueChanged ("PopHeight", popHeight); + NotifyValueChangedAuto (popHeight); } } #endregion diff --git a/Crow/src/Widgets/MessageBox.cs b/Crow/src/Widgets/MessageBox.cs index e5746c60..495d82d6 100644 --- a/Crow/src/Widgets/MessageBox.cs +++ b/Crow/src/Widgets/MessageBox.cs @@ -67,7 +67,7 @@ namespace Crow if (message == value) return; message = value; - NotifyValueChanged ("Message", message); + NotifyValueChangedAuto (message); } } [DefaultValue("Ok")] @@ -78,7 +78,7 @@ namespace Crow if (okMessage == value) return; okMessage = value; - NotifyValueChanged ("OkMessage", okMessage); + NotifyValueChangedAuto (okMessage); } } [DefaultValue("Cancel")] @@ -89,7 +89,7 @@ namespace Crow if (cancelMessage == value) return; cancelMessage = value; - NotifyValueChanged ("CancelMessage", cancelMessage); + NotifyValueChangedAuto (cancelMessage); } } [DefaultValue("No")] @@ -100,7 +100,7 @@ namespace Crow if (noMessage == value) return; noMessage = value; - NotifyValueChanged ("NoMessage", noMessage); + NotifyValueChangedAuto (noMessage); } } [DefaultValue("Information")] @@ -111,7 +111,7 @@ namespace Crow if (msgType == value) return; msgType = value; - NotifyValueChanged ("MsgType", msgType); + NotifyValueChangedAuto (msgType); switch (msgType) { case Type.Information: MsgIcon = "#Crow.Icons.iconInfo.svg"; @@ -155,7 +155,7 @@ namespace Crow if (value == MsgIcon) return; msgIcon = value; - NotifyValueChanged ("MsgIcon", MsgIcon); + NotifyValueChangedAuto (MsgIcon); } } void onOkButtonClick (object sender, EventArgs e) diff --git a/Crow/src/Widgets/NumericControl.cs b/Crow/src/Widgets/NumericControl.cs index 9359d648..8a0eb7d6 100644 --- a/Crow/src/Widgets/NumericControl.cs +++ b/Crow/src/Widgets/NumericControl.cs @@ -56,7 +56,7 @@ namespace Crow if (value == _decimals) return; _decimals = value; - NotifyValueChanged("Decimals", _decimals); + NotifyValueChangedAuto (_decimals); RegisterForGraphicUpdate(); } } @@ -68,7 +68,7 @@ namespace Crow return; minValue = value; - NotifyValueChanged ("Minimum", minValue); + NotifyValueChangedAuto (minValue); RegisterForRedraw (); } } @@ -81,7 +81,7 @@ namespace Crow return; maxValue = value; - NotifyValueChanged ("Maximum", maxValue); + NotifyValueChangedAuto (maxValue); RegisterForRedraw (); } } @@ -94,7 +94,7 @@ namespace Crow return; smallStep = value; - NotifyValueChanged ("SmallIncrement", smallStep); + NotifyValueChangedAuto (smallStep); RegisterForRedraw (); } } @@ -107,7 +107,7 @@ namespace Crow return; bigStep = value; - NotifyValueChanged ("LargeIncrement", bigStep); + NotifyValueChangedAuto (bigStep); RegisterForRedraw (); } } @@ -129,7 +129,7 @@ namespace Crow _actualValue = Math.Round (_actualValue, _decimals); - NotifyValueChanged("Value", _actualValue); + NotifyValueChangedAuto (_actualValue); RegisterForGraphicUpdate(); } } diff --git a/Crow/src/Widgets/Popper.cs b/Crow/src/Widgets/Popper.cs index fc5ff0da..2fc5629d 100644 --- a/Crow/src/Widgets/Popper.cs +++ b/Crow/src/Widgets/Popper.cs @@ -30,7 +30,7 @@ namespace Crow if (popWidth == value) return; popWidth = value; - NotifyValueChanged ("PopWidth", popWidth); + NotifyValueChangedAuto (popWidth); } } [DefaultValue("Fit")] @@ -40,7 +40,7 @@ namespace Crow if (popHeight == value) return; popHeight = value; - NotifyValueChanged ("PopHeight", popHeight); + NotifyValueChangedAuto (popHeight); } } [DefaultValue(false)] @@ -57,7 +57,7 @@ namespace Crow _isPopped = value; - NotifyValueChanged ("IsPopped", _isPopped); + NotifyValueChangedAuto (_isPopped); if (_isPopped) onPop (this, null); @@ -76,7 +76,7 @@ namespace Crow return; _canPop = value; - NotifyValueChanged ("CanPop", _canPop); + NotifyValueChangedAuto (_canPop); } } [DefaultValue(Alignment.Bottom)] @@ -86,7 +86,7 @@ namespace Crow if (popDirection == value) return; popDirection = value; - NotifyValueChanged ("PopDirection", popDirection); + NotifyValueChangedAuto (popDirection); } } #endregion diff --git a/Crow/src/Widgets/RadioButton.cs b/Crow/src/Widgets/RadioButton.cs index 220e56e8..116863b4 100644 --- a/Crow/src/Widgets/RadioButton.cs +++ b/Crow/src/Widgets/RadioButton.cs @@ -50,7 +50,7 @@ namespace Crow isChecked = value; - NotifyValueChanged ("IsChecked", value); + NotifyValueChangedAuto (value); if (isChecked) Checked.Raise (this, null); diff --git a/Crow/src/Widgets/SaturationValueSelector.cs b/Crow/src/Widgets/SaturationValueSelector.cs index 9732878b..a2b39567 100644 --- a/Crow/src/Widgets/SaturationValueSelector.cs +++ b/Crow/src/Widgets/SaturationValueSelector.cs @@ -23,7 +23,7 @@ namespace Crow if (v == value) return; v = value; - NotifyValueChanged ("V", v); + NotifyValueChangedAuto (v); mousePos.Y = (int)Math.Floor((1.0-v) * (double)ClientRectangle.Height); RegisterForRedraw (); @@ -36,7 +36,7 @@ namespace Crow if (s == value) return; s = value; - NotifyValueChanged ("S", s); + NotifyValueChangedAuto (s); mousePos.X = (int)Math.Floor(s * (double)ClientRectangle.Width); RegisterForRedraw (); diff --git a/Crow/src/Widgets/Scalable.cs b/Crow/src/Widgets/Scalable.cs index e38aded0..1d691612 100644 --- a/Crow/src/Widgets/Scalable.cs +++ b/Crow/src/Widgets/Scalable.cs @@ -27,7 +27,7 @@ namespace Crow if (scaled == value) return; scaled = value; - NotifyValueChanged ("Scaled", scaled); + NotifyValueChangedAuto (scaled); RegisterForGraphicUpdate (); } } @@ -41,7 +41,7 @@ namespace Crow if (keepProps == value) return; keepProps = value; - NotifyValueChanged ("KeepProportions", keepProps); + NotifyValueChangedAuto (keepProps); RegisterForGraphicUpdate (); } } diff --git a/Crow/src/Widgets/ScrollBar.cs b/Crow/src/Widgets/ScrollBar.cs index 612a3e63..15695e5d 100644 --- a/Crow/src/Widgets/ScrollBar.cs +++ b/Crow/src/Widgets/ScrollBar.cs @@ -30,7 +30,7 @@ namespace Crow if (_orientation == value) return; _orientation = value; - NotifyValueChanged ("Orientation", _orientation); + NotifyValueChangedAuto (_orientation); if (_orientation == Orientation.Horizontal) NotifyValueChanged ("ScrollBackShape", "M 1.5,3.5 L 6.5,0.5 L 6.5,6.5 Z G"); else @@ -47,7 +47,7 @@ namespace Crow return; _cursorSize = value; RegisterForGraphicUpdate (); - NotifyValueChanged ("CursorSize", _cursorSize); + NotifyValueChangedAuto (_cursorSize); } } public void onScrollBack (object sender, MouseButtonEventArgs e) diff --git a/Crow/src/Widgets/Scroller.cs b/Crow/src/Widgets/Scroller.cs index 33695df0..0314be50 100644 --- a/Crow/src/Widgets/Scroller.cs +++ b/Crow/src/Widgets/Scroller.cs @@ -48,7 +48,7 @@ namespace Crow scrollX = newS; - NotifyValueChanged ("ScrollX", scrollX); + NotifyValueChangedAuto (scrollX); RegisterForGraphicUpdate (); } } @@ -71,7 +71,7 @@ namespace Crow scrollY = newS; - NotifyValueChanged ("ScrollY", scrollY); + NotifyValueChangedAuto (scrollY); RegisterForGraphicUpdate (); } } @@ -91,7 +91,7 @@ namespace Crow if (scrollX > maxScrollX) ScrollX = maxScrollX; - NotifyValueChanged ("MaxScrollX", maxScrollX); + NotifyValueChangedAuto (maxScrollX); RegisterForGraphicUpdate (); } } @@ -112,7 +112,7 @@ namespace Crow if (scrollY > maxScrollY) ScrollY = maxScrollY; - NotifyValueChanged ("MaxScrollY", maxScrollY); + NotifyValueChangedAuto (maxScrollY); RegisterForGraphicUpdate (); } } @@ -126,7 +126,7 @@ namespace Crow scrollSpeed = value; - NotifyValueChanged ("ScrollSpeed", scrollSpeed); + NotifyValueChangedAuto (scrollSpeed); } } #endregion diff --git a/Crow/src/Widgets/ScrollingObject.cs b/Crow/src/Widgets/ScrollingObject.cs index 8f0c81a4..2545ffc7 100644 --- a/Crow/src/Widgets/ScrollingObject.cs +++ b/Crow/src/Widgets/ScrollingObject.cs @@ -45,7 +45,7 @@ namespace Crow scrollX = newS; - NotifyValueChanged ("ScrollX", scrollX); + NotifyValueChangedAuto (scrollX); RegisterForGraphicUpdate (); } } @@ -68,7 +68,7 @@ namespace Crow scrollY = newS; - NotifyValueChanged ("ScrollY", scrollY); + NotifyValueChangedAuto (scrollY); RegisterForGraphicUpdate (); } } @@ -85,7 +85,7 @@ namespace Crow if (scrollX > maxScrollX) ScrollX = maxScrollX; - NotifyValueChanged ("MaxScrollX", maxScrollX); + NotifyValueChangedAuto (maxScrollX); RegisterForGraphicUpdate (); } } @@ -102,7 +102,7 @@ namespace Crow if (scrollY > maxScrollY) ScrollY = maxScrollY; - NotifyValueChanged ("MaxScrollY", maxScrollY); + NotifyValueChangedAuto (maxScrollY); RegisterForGraphicUpdate (); } } @@ -116,7 +116,7 @@ namespace Crow mouseWheelSpeed = value; - NotifyValueChanged ("MouseWheelSpeed", mouseWheelSpeed); + NotifyValueChangedAuto (mouseWheelSpeed); } } diff --git a/Crow/src/Widgets/Shape.cs b/Crow/src/Widgets/Shape.cs index c30099a4..7f43061d 100644 --- a/Crow/src/Widgets/Shape.cs +++ b/Crow/src/Widgets/Shape.cs @@ -155,7 +155,7 @@ namespace Crow return; path = value; contentSize = default (Size); - NotifyValueChanged ("Path", path); + NotifyValueChangedAuto (path); RegisterForGraphicUpdate (); } } @@ -171,7 +171,7 @@ namespace Crow return; strokeWidth = value; contentSize = default (Size); - NotifyValueChanged ("StrokeWidth", strokeWidth); + NotifyValueChangedAuto (strokeWidth); RegisterForGraphicUpdate (); } } @@ -186,7 +186,7 @@ namespace Crow return; size = value; contentSize = default (Size); - NotifyValueChanged ("Size", size); + NotifyValueChangedAuto (size); RegisterForLayouting (LayoutingType.Sizing); } } diff --git a/Crow/src/Widgets/Slider.cs b/Crow/src/Widgets/Slider.cs index 73518ecb..4a6d8bb0 100644 --- a/Crow/src/Widgets/Slider.cs +++ b/Crow/src/Widgets/Slider.cs @@ -52,7 +52,7 @@ namespace Crow return; _cursorColor = value; RegisterForRedraw (); - NotifyValueChanged ("CursorColor", _cursorColor); + NotifyValueChangedAuto (_cursorColor); } } [DefaultValue(20)] @@ -63,7 +63,7 @@ namespace Crow return; _cursorSize = value; RegisterForGraphicUpdate (); - NotifyValueChanged ("CursorSize", _cursorSize); + NotifyValueChangedAuto (_cursorSize); } } [DefaultValue(Orientation.Horizontal)] @@ -76,7 +76,7 @@ namespace Crow _orientation = value; RegisterForLayouting (LayoutingType.All); - NotifyValueChanged ("Orientation", _orientation); + NotifyValueChangedAuto (_orientation); } } [DefaultValue (CursorType.Rectangle)] @@ -86,7 +86,7 @@ namespace Crow if (cursorType == value) return; cursorType = value; - NotifyValueChanged ("CursorType", cursorType); + NotifyValueChangedAuto (cursorType); RegisterForRedraw (); } } diff --git a/Crow/src/Widgets/Splitter.cs b/Crow/src/Widgets/Splitter.cs index f2c0a084..f385534c 100644 --- a/Crow/src/Widgets/Splitter.cs +++ b/Crow/src/Widgets/Splitter.cs @@ -26,8 +26,8 @@ namespace Crow set { if (thickness == value) return; - thickness = value; - NotifyValueChanged ("Thickness", thickness); + thickness = value; + NotifyValueChangedAuto (thickness); RegisterForLayouting (LayoutingType.Sizing); RegisterForGraphicUpdate (); } diff --git a/Crow/src/Widgets/TabItem.cs b/Crow/src/Widgets/TabItem.cs index c57807c8..25c89ae3 100644 --- a/Crow/src/Widgets/TabItem.cs +++ b/Crow/src/Widgets/TabItem.cs @@ -63,7 +63,7 @@ namespace Crow if (viewIndex == value) return; viewIndex = value; - NotifyValueChanged ("ViewIndex", viewIndex); + NotifyValueChangedAuto (viewIndex); } } @@ -74,7 +74,7 @@ namespace Crow if (tabOffset == value) return; tabOffset = value; - NotifyValueChanged ("TabOffset", tabOffset); + NotifyValueChangedAuto (tabOffset); RegisterForLayouting (LayoutingType.X); RegisterForGraphicUpdate (); @@ -97,7 +97,7 @@ namespace Crow tview.SelectedTab = tview.Children.IndexOf(this); isSelected = value; - NotifyValueChanged ("IsSelected", isSelected); + NotifyValueChangedAuto (isSelected); RegisterForRedraw (); } } @@ -114,7 +114,7 @@ namespace Crow if (value == null) return; selectedBackground = value; - NotifyValueChanged ("SelectedBackground", selectedBackground); + NotifyValueChangedAuto (selectedBackground); RegisterForRedraw (); } } diff --git a/Crow/src/Widgets/TabView.cs b/Crow/src/Widgets/TabView.cs index 8699d316..cce32883 100644 --- a/Crow/src/Widgets/TabView.cs +++ b/Crow/src/Widgets/TabView.cs @@ -34,7 +34,7 @@ namespace Crow if (_orientation == value) return; _orientation = value; - NotifyValueChanged ("Orientation", _orientation); + NotifyValueChangedAuto (_orientation); if (_orientation == Orientation.Horizontal) NotifyValueChanged ("TabOrientation", Orientation.Vertical); else @@ -50,7 +50,7 @@ namespace Crow if (leftSlope == value) return; leftSlope = value; - NotifyValueChanged ("leftSlope", leftSlope); + NotifyValueChangedAuto (leftSlope); //tabSizeHasChanged = true; //RegisterForLayouting (LayoutingType.ArrangeChildren); } @@ -64,7 +64,7 @@ namespace Crow if (rightSlope == value) return; rightSlope = value; - NotifyValueChanged ("RightSlope", rightSlope); + NotifyValueChangedAuto (rightSlope); //tabSizeHasChanged = true; //RegisterForLayouting (LayoutingType.ArrangeChildren); } @@ -76,7 +76,7 @@ namespace Crow if (tabHeight == value) return; tabHeight = value; - NotifyValueChanged ("TabHeight", tabHeight); + NotifyValueChangedAuto (tabHeight); // childrenRWLock.EnterReadLock (); // foreach (GraphicObject ti in Children) { // ti.NotifyValueChanged ("TabHeight", tabHeight); @@ -92,7 +92,7 @@ namespace Crow if (tabWidth == value) return; tabWidth = value; - NotifyValueChanged ("TabWidth", TabWidth); + NotifyValueChangedAuto (TabWidth); // // childrenRWLock.EnterReadLock (); // foreach (GraphicObject ti in Children) { @@ -117,7 +117,7 @@ namespace Crow if (selectedTab < Children.Count && selectedTab >= 0) (Children [selectedTab] as TabItem).IsSelected = true; - NotifyValueChanged ("SelectedTab", selectedTab); + NotifyValueChangedAuto (selectedTab); RegisterForRedraw (); } } diff --git a/Crow/src/Widgets/TemplatedControl.cs b/Crow/src/Widgets/TemplatedControl.cs index 965676e7..614bc1ac 100644 --- a/Crow/src/Widgets/TemplatedControl.cs +++ b/Crow/src/Widgets/TemplatedControl.cs @@ -67,7 +67,7 @@ namespace Crow if (caption == value) return; caption = value; - NotifyValueChanged ("Caption", caption); + NotifyValueChangedAuto (caption); } } diff --git a/Crow/src/Widgets/TemplatedGroup.cs b/Crow/src/Widgets/TemplatedGroup.cs index 72cd452c..5916af84 100644 --- a/Crow/src/Widgets/TemplatedGroup.cs +++ b/Crow/src/Widgets/TemplatedGroup.cs @@ -80,7 +80,7 @@ namespace Crow { _itemTemplate = value; //TODO:reload list with new template? - NotifyValueChanged("ItemTemplate", _itemTemplate); + NotifyValueChangedAuto (_itemTemplate); } } protected override void loadTemplate(Widget template = null) @@ -110,7 +110,7 @@ namespace Crow { dataTest = value; - NotifyValueChanged("DataTest", dataTest); + NotifyValueChangedAuto (dataTest); } } #endregion @@ -131,7 +131,7 @@ namespace Crow { if (selColoring == value) return; selColoring = value; - NotifyValueChanged ("SelectionColoring", selColoring); + NotifyValueChangedAuto (selColoring); } } [DefaultValue(-1)]public virtual int SelectedIndex{ @@ -152,7 +152,7 @@ namespace Crow { Items[_selectedIndex].Background = SelectionBackground; } - NotifyValueChanged ("SelectedIndex", _selectedIndex); + NotifyValueChangedAuto (_selectedIndex); NotifyValueChanged ("SelectedItem", SelectedItem); SelectedItemChanged.Raise (this, new SelectionChangeEventArgs (SelectedItem)); } @@ -198,7 +198,7 @@ namespace Crow { ol.ListEdit += Ol_ListEdit; } - NotifyValueChanged ("Data", data); + NotifyValueChangedAuto (data); lock (IFace.UpdateMutex) ClearItems (); @@ -252,7 +252,7 @@ namespace Crow { if (value == selBackground) return; selBackground = value; - NotifyValueChanged ("SelectionBackground", selBackground); + NotifyValueChangedAuto (selBackground); RegisterForRedraw (); } } @@ -263,7 +263,7 @@ namespace Crow { if (value == selForeground) return; selForeground = value; - NotifyValueChanged ("SelectionForeground", selForeground); + NotifyValueChangedAuto (selForeground); RegisterForRedraw (); } } diff --git a/Crow/src/Widgets/TextRun.cs b/Crow/src/Widgets/TextRun.cs index 09720baf..042dbdbc 100644 --- a/Crow/src/Widgets/TextRun.cs +++ b/Crow/src/Widgets/TextRun.cs @@ -51,7 +51,7 @@ namespace Crow return; horizontalStretch = value; RegisterForRedraw (); - NotifyValueChanged ("HorizontalStretch", horizontalStretch); + NotifyValueChangedAuto (horizontalStretch); } } @@ -63,7 +63,7 @@ namespace Crow return; verticalStretch = value; RegisterForRedraw (); - NotifyValueChanged ("VerticalStretch", verticalStretch); + NotifyValueChangedAuto (verticalStretch); } } diff --git a/Crow/src/Widgets/TreeView.cs b/Crow/src/Widgets/TreeView.cs index 87d22006..e150ef86 100644 --- a/Crow/src/Widgets/TreeView.cs +++ b/Crow/src/Widgets/TreeView.cs @@ -26,7 +26,7 @@ namespace Crow if (isRoot == value) return; isRoot = value; - NotifyValueChanged ("IsRoot", isRoot); + NotifyValueChangedAuto (isRoot); } } [XmlIgnore]public override object SelectedItem { diff --git a/Crow/src/Widgets/Trend.cs b/Crow/src/Widgets/Trend.cs index 414ee82a..ebc3cedb 100644 --- a/Crow/src/Widgets/Trend.cs +++ b/Crow/src/Widgets/Trend.cs @@ -43,7 +43,7 @@ namespace Crow return; nbValues = value; - NotifyValueChanged ("NbValues", minValue); + NotifyValueChangedAuto (minValue); RegisterForRedraw (); } } @@ -55,7 +55,7 @@ namespace Crow return; minValue = value; - NotifyValueChanged ("Minimum", minValue); + NotifyValueChangedAuto (minValue); RegisterForRedraw (); } } @@ -68,7 +68,7 @@ namespace Crow return; maxValue = value; - NotifyValueChanged ("Maximum", maxValue); + NotifyValueChangedAuto (maxValue); RegisterForRedraw (); } } @@ -79,7 +79,7 @@ namespace Crow if (lowThreshold == value) return; lowThreshold = value; - NotifyValueChanged ("LowThreshold", lowThreshold); + NotifyValueChangedAuto (lowThreshold); RegisterForGraphicUpdate (); } } @@ -90,7 +90,7 @@ namespace Crow if (highThreshold == value) return; highThreshold = value; - NotifyValueChanged ("HighThreshold", highThreshold); + NotifyValueChangedAuto (highThreshold); RegisterForGraphicUpdate (); } } @@ -101,7 +101,7 @@ namespace Crow if (lowThresholdFill == value) return; lowThresholdFill = value; - NotifyValueChanged ("LowThresholdFill", lowThresholdFill); + NotifyValueChangedAuto (lowThresholdFill); RegisterForRedraw (); } } @@ -112,7 +112,7 @@ namespace Crow if (highThresholdFill == value) return; highThresholdFill = value; - NotifyValueChanged ("HighThresholdFill", highThresholdFill); + NotifyValueChangedAuto (highThresholdFill); RegisterForRedraw (); } } diff --git a/Crow/src/Widgets/Widget.cs b/Crow/src/Widgets/Widget.cs index b103ac56..de079e15 100644 --- a/Crow/src/Widgets/Widget.cs +++ b/Crow/src/Widgets/Widget.cs @@ -212,6 +212,10 @@ namespace Crow //Debug.WriteLine ("Value changed: {0}->{1} = {2}", this, MemberName, _value); ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value)); } + public void NotifyValueChangedAuto (object _value, [CallerMemberName] string caller = null) + { + NotifyValueChanged (caller, _value); + } #endregion #region CTOR @@ -469,7 +473,7 @@ namespace Crow if (tag == value) return; tag = value; - NotifyValueChanged ("Tag", tag); + NotifyValueChangedAuto (tag); } } /// @@ -483,7 +487,7 @@ namespace Crow if (cacheEnabled == value) return; cacheEnabled = value; - NotifyValueChanged ("CacheEnabled", cacheEnabled); + NotifyValueChangedAuto (cacheEnabled); } } /// @@ -496,7 +500,7 @@ namespace Crow if (clipToClientRect == value) return; clipToClientRect = value; - NotifyValueChanged ("ClipToClientRect", clipToClientRect); + NotifyValueChangedAuto (clipToClientRect); this.RegisterForRedraw (); } } @@ -523,7 +527,7 @@ namespace Crow if (name == value) return; name = value; - NotifyValueChanged("Name", name); + NotifyValueChangedAuto (name); } } /// @@ -538,7 +542,7 @@ namespace Crow return; verticalAlignment = value; - NotifyValueChanged("VerticalAlignment", verticalAlignment); + NotifyValueChangedAuto (verticalAlignment); RegisterForLayouting (LayoutingType.Y); } } @@ -553,7 +557,7 @@ namespace Crow if (horizontalAlignment == value) return; horizontalAlignment = value; - NotifyValueChanged("HorizontalAlignment", horizontalAlignment); + NotifyValueChangedAuto (horizontalAlignment); RegisterForLayouting (LayoutingType.X); } } @@ -567,7 +571,7 @@ namespace Crow if (left == value) return; left = value; - NotifyValueChanged ("Left", left); + NotifyValueChangedAuto (left); this.RegisterForLayouting (LayoutingType.X); } } @@ -581,7 +585,7 @@ namespace Crow if (top == value) return; top = value; - NotifyValueChanged ("Top", top); + NotifyValueChangedAuto (top); this.RegisterForLayouting (LayoutingType.Y); } } @@ -617,7 +621,7 @@ namespace Crow return; } width = value; - NotifyValueChanged ("Width", width); + NotifyValueChangedAuto (width); RegisterForLayouting (LayoutingType.Width); } } @@ -640,7 +644,7 @@ namespace Crow return; } height = value; - NotifyValueChanged ("Height", height); + NotifyValueChangedAuto (height); RegisterForLayouting (LayoutingType.Height); } } @@ -667,7 +671,7 @@ namespace Crow if (focusable == value) return; focusable = value; - NotifyValueChanged ("Focusable", focusable); + NotifyValueChangedAuto (focusable); } } /// @@ -684,7 +688,7 @@ namespace Crow onFocused (this, null); else onUnfocused (this, null); - NotifyValueChanged ("HasFocus", hasFocus); + NotifyValueChangedAuto (hasFocus); } } /// @@ -698,7 +702,7 @@ namespace Crow return; isActive = value; - NotifyValueChanged ("IsActive", isActive); + NotifyValueChangedAuto (isActive); } } /// @@ -715,7 +719,7 @@ namespace Crow if (isHover) Hover.Raise (this, null); - NotifyValueChanged ("IsHover", isHover); + NotifyValueChangedAuto (isHover); } } /// @@ -728,7 +732,7 @@ namespace Crow if (mouseRepeat == value) return; mouseRepeat = value; - NotifyValueChanged ("MouseRepeat", mouseRepeat); + NotifyValueChangedAuto (mouseRepeat); } } /// @@ -742,7 +746,7 @@ namespace Crow if (mouseCursor == value) return; mouseCursor = value; - NotifyValueChanged ("MouseCursor", mouseCursor); + NotifyValueChangedAuto (mouseCursor); this.RegisterForRedraw (); if (isHover) @@ -777,7 +781,7 @@ namespace Crow if (value == null) return; background = value; - NotifyValueChanged ("Background", background); + NotifyValueChangedAuto (background); RegisterForRedraw (); if (background is SolidColor sc && sc.Equals (Colors.Clear)) clearBackground = true; @@ -793,7 +797,7 @@ namespace Crow if (foreground == value) return; foreground = value; - NotifyValueChanged ("Foreground", foreground); + NotifyValueChangedAuto (foreground); RegisterForRedraw (); } } @@ -807,7 +811,7 @@ namespace Crow if (value == font) return; font = value; - NotifyValueChanged ("Font", font); + NotifyValueChangedAuto (font); RegisterForGraphicUpdate (); } } @@ -821,7 +825,7 @@ namespace Crow if (value == cornerRadius) return; cornerRadius = value; - NotifyValueChanged ("CornerRadius", cornerRadius); + NotifyValueChangedAuto (cornerRadius); RegisterForRedraw (); } } @@ -836,7 +840,7 @@ namespace Crow if (value == margin) return; margin = value; - NotifyValueChanged ("Margin", margin); + NotifyValueChangedAuto (margin); RegisterForGraphicUpdate (); } } @@ -861,7 +865,7 @@ namespace Crow } } - NotifyValueChanged ("Visible", isVisible); + NotifyValueChangedAuto (isVisible); } } /// @@ -882,7 +886,7 @@ namespace Crow else onDisable (this, null); - NotifyValueChanged ("IsEnabled", isEnabled); + NotifyValueChangedAuto (isEnabled); RegisterForRedraw (); } } @@ -898,7 +902,7 @@ namespace Crow minimumSize = value; - NotifyValueChanged ("MinimumSize", minimumSize); + NotifyValueChangedAuto (minimumSize); RegisterForLayouting (LayoutingType.Sizing); } } @@ -914,7 +918,7 @@ namespace Crow maximumSize = value; - NotifyValueChanged (nameof(MaximumSize), maximumSize); + NotifyValueChangedAuto (maximumSize); RegisterForLayouting (LayoutingType.Sizing); } } @@ -954,7 +958,7 @@ namespace Crow #endif lock (IFace.UpdateMutex) { OnDataSourceChanged (this, dse); - NotifyValueChanged ("DataSource", DataSource); + NotifyValueChangedAuto (DataSource); } #if DEBUG_LOG dbgEvt.end = DebugLog.chrono.ElapsedTicks; @@ -977,7 +981,7 @@ namespace Crow if (rootDataLevel == value) return; rootDataLevel = value; - NotifyValueChanged ("RootDataLevel", rootDataLevel); + NotifyValueChangedAuto (rootDataLevel); this.RegisterForRedraw (); } } @@ -1010,7 +1014,7 @@ namespace Crow style = value; - NotifyValueChanged ("Style", style); + NotifyValueChangedAuto (style); } } [DesignCategory ("Divers")] @@ -1020,7 +1024,7 @@ namespace Crow if (tooltip == value) return; tooltip = value; - NotifyValueChanged("Tooltip", tooltip); + NotifyValueChangedAuto (tooltip); } } [DesignCategory ("Divers")] @@ -1030,7 +1034,7 @@ namespace Crow if (contextCommands == value) return; contextCommands = value; - NotifyValueChanged("ContextCommands", contextCommands); + NotifyValueChangedAuto (contextCommands); } } #endregion diff --git a/Crow/src/Widgets/Window.cs b/Crow/src/Widgets/Window.cs index ddf730ad..fb09ba04 100644 --- a/Crow/src/Widgets/Window.cs +++ b/Crow/src/Widgets/Window.cs @@ -68,7 +68,7 @@ namespace Crow if (_icon == value) return; _icon = value; - NotifyValueChanged ("Icon", _icon); + NotifyValueChangedAuto (_icon); } } /// @@ -81,7 +81,7 @@ namespace Crow if (titleBarBackground == value) return; titleBarBackground = value; - NotifyValueChanged ("TitleBarBackground", titleBarBackground); + NotifyValueChangedAuto (titleBarBackground); RegisterForRedraw (); } } @@ -95,7 +95,7 @@ namespace Crow if (titleBarForeground == value) return; titleBarForeground = value; - NotifyValueChanged ("TitleBarForeground", titleBarForeground); + NotifyValueChangedAuto (titleBarForeground); RegisterForRedraw (); } } @@ -108,7 +108,7 @@ namespace Crow if (resizable == value) return; resizable = value; - NotifyValueChanged ("Resizable", resizable); + NotifyValueChangedAuto (resizable); } } [DefaultValue(true)] @@ -120,7 +120,7 @@ namespace Crow if (movable == value) return; movable = value; - NotifyValueChanged ("Movable", movable); + NotifyValueChangedAuto (movable); } } [DefaultValue(false)] @@ -132,7 +132,7 @@ namespace Crow if (modal == value) return; modal = value; - NotifyValueChanged ("Modal", modal); + NotifyValueChangedAuto (modal); } } [DefaultValue(false)] @@ -145,7 +145,7 @@ namespace Crow _minimized = value; _contentContainer.Visible = !_minimized; - NotifyValueChanged ("IsMinimized", _minimized); + NotifyValueChangedAuto (_minimized); } } [XmlIgnore]public bool IsMaximized { @@ -168,7 +168,7 @@ namespace Crow if (AlwaysOnTop && Parent != null) IFace.PutOnTop (this); - NotifyValueChanged ("AlwaysOnTop", AlwaysOnTop); + NotifyValueChangedAuto (AlwaysOnTop); } } // [DefaultValue(WindowState.Normal)] diff --git a/Samples/ShowCase/ShowCase.cs b/Samples/ShowCase/ShowCase.cs index daab96e2..346c2d1d 100644 --- a/Samples/ShowCase/ShowCase.cs +++ b/Samples/ShowCase/ShowCase.cs @@ -7,6 +7,7 @@ using Crow; using System.IO; using System.Text; using Crow.IML; +using System.Runtime.CompilerServices; namespace ShowCase { @@ -24,14 +25,28 @@ namespace ShowCase public Container crowContainer; public string CurrentDir { - get { return Configuration.Global.Get ("CurrentDir"); } + get { return Configuration.Global.Get (nameof (CurrentDir)); } set { if (CurrentDir == value) return; - Configuration.Global.Set ("CurrentDir", value); - NotifyValueChanged ("CurrentDir",CurrentDir); + Configuration.Global.Set (nameof (CurrentDir), value); + NotifyValueChanged (CurrentDir); } } + + string source = @"