コード例 #1
0
        private void btnADelete_Click(object sender, RoutedEventArgs e)
        {
            var selectedItem = (KeyValuePair <string, string>)lstDisplayColumns.SelectedItem;

            DisplayColumnsList.Remove(selectedItem.Key.ToString());

            ColumnsList.Add(selectedItem.Key, selectedItem.Value);

            lstAllColumns.Items.Refresh();

            lstDisplayColumns.Items.Refresh();
        }
コード例 #2
0
        public JsonResult Columns_Create(ColumnModel model)
        {
            int lastID = ColumnsList.Select(m => m.ID).Max();
            int order  = ColumnsList.Select(m => m.Order).Max();

            model.ID     = lastID + 1;
            model.Order  = order + 1;
            model.Status = model.Text.ToLowerInvariant();
            ColumnsList.Add(model);

            return(Json(model));
        }
コード例 #3
0
        private void btnAddColumn_Click(object sender, EventArgs e)
        {
            UpdateLayoutForColumn();

            var columnControl = new ColumnSettings(CurrentState, "#" + (ColumnsList.Count + 1), ColumnsList);

            ColumnsList.Add(columnControl);
            AddColumnToLayout(columnControl, ColumnsList.Count);

            foreach (var column in ColumnsList)
            {
                column.UpdateEnabledButtons();
            }
        }
コード例 #4
0
        public void RegisterColumn(IMGridColumn pColumn)
        {
            if (ColumnsList.Any(c => c.Identifier == pColumn.Identifier))
            {
                return;
            }

            ColumnsList.Add(pColumn);

            if (pColumn is MGridActionColumn <T> )
            {
                mHasActionColumn = true;
            }

            if (pColumn is IMGridPropertyColumn propc)
            {
                var iprop = ReflectionHelper.GetIMPropertyInfo(typeof(T), propc.Property, propc.PropertyType);

                propc.PropertyType = iprop.PropertyType;

                if (propc.Attributes != null)
                {
                    iprop.SetAttributes(propc.Attributes);
                }

                mPropertyInfoCache.Add(propc, iprop);

                if (pColumn is IMGridSortableColumn sc && sc.SortDirection != MSortDirection.None)
                {
                    object comparer = null;

                    if (pColumn is IMGridCustomComparer)
                    {
                        comparer = ((dynamic)pColumn).Comparer;
                    }

                    SortInstructions.Add(new SortInstruction()
                    {
                        Direction    = sc.SortDirection,
                        PropertyInfo = iprop,
                        Index        = sc.SortIndex,
                        Comparer     = comparer
                    });
                }
            }

            mFilterModel = null;
            ClearDataCache();
            StateHasChanged();
        }
コード例 #5
0
        public void SetSettings(XmlNode node)
        {
            var     element = (XmlElement)node;
            Version version = SettingsHelper.ParseVersion(element["Version"]);

            CurrentSplitTopColor    = SettingsHelper.ParseColor(element["CurrentSplitTopColor"]);
            CurrentSplitBottomColor = SettingsHelper.ParseColor(element["CurrentSplitBottomColor"]);
            VisualSplitCount        = SettingsHelper.ParseInt(element["VisualSplitCount"]);
            SplitPreviewCount       = SettingsHelper.ParseInt(element["SplitPreviewCount"]);
            DisplayIcons            = SettingsHelper.ParseBool(element["DisplayIcons"]);
            ShowThinSeparators      = SettingsHelper.ParseBool(element["ShowThinSeparators"]);
            AlwaysShowLastSplit     = SettingsHelper.ParseBool(element["AlwaysShowLastSplit"]);
            SplitWidth             = SettingsHelper.ParseFloat(element["SplitWidth"]);
            AutomaticAbbreviations = SettingsHelper.ParseBool(element["AutomaticAbbreviations"], false);
            ShowColumnLabels       = SettingsHelper.ParseBool(element["ShowColumnLabels"], false);
            LabelsColor            = SettingsHelper.ParseColor(element["LabelsColor"], Color.FromArgb(255, 255, 255));
            OverrideTimesColor     = SettingsHelper.ParseBool(element["OverrideTimesColor"], false);
            BeforeTimesColor       = SettingsHelper.ParseColor(element["BeforeTimesColor"], Color.FromArgb(255, 255, 255));
            CurrentTimesColor      = SettingsHelper.ParseColor(element["CurrentTimesColor"], Color.FromArgb(255, 255, 255));
            AfterTimesColor        = SettingsHelper.ParseColor(element["AfterTimesColor"], Color.FromArgb(255, 255, 255));
            SplitHeight            = SettingsHelper.ParseFloat(element["SplitHeight"], 6);
            SplitGradientString    = SettingsHelper.ParseString(element["CurrentSplitGradient"], GradientType.Vertical.ToString());
            BackgroundColor        = SettingsHelper.ParseColor(element["BackgroundColor"], Color.Transparent);
            BackgroundColor2       = SettingsHelper.ParseColor(element["BackgroundColor2"], Color.Transparent);
            GradientString         = SettingsHelper.ParseString(element["BackgroundGradient"], ExtendedGradientType.Plain.ToString());
            SeparatorLastSplit     = SettingsHelper.ParseBool(element["SeparatorLastSplit"], true);
            DropDecimals           = SettingsHelper.ParseBool(element["DropDecimals"], true);
            DeltasAccuracy         = SettingsHelper.ParseEnum(element["DeltasAccuracy"], TimeAccuracy.Tenths);
            OverrideDeltasColor    = SettingsHelper.ParseBool(element["OverrideDeltasColor"], false);
            DeltasColor            = SettingsHelper.ParseColor(element["DeltasColor"], Color.FromArgb(255, 255, 255));
            Display2Rows           = SettingsHelper.ParseBool(element["Display2Rows"], false);
            SplitTimesAccuracy     = SettingsHelper.ParseEnum(element["SplitTimesAccuracy"], TimeAccuracy.Seconds);
            ShowBlankSplits        = SettingsHelper.ParseBool(element["ShowBlankSplits"], true);
            LockLastSplit          = SettingsHelper.ParseBool(element["LockLastSplit"], false);
            IconSize    = SettingsHelper.ParseFloat(element["IconSize"], 24f);
            IconShadows = SettingsHelper.ParseBool(element["IconShadows"], true);

            if (version >= new Version(1, 5))
            {
                var columnsElement = element["Columns"];
                ColumnsList.Clear();
                foreach (var child in columnsElement.ChildNodes)
                {
                    var columnData = ColumnData.FromXml((XmlNode)child);
                    ColumnsList.Add(new ColumnSettings(CurrentState, columnData.Name, ColumnsList)
                    {
                        Data = columnData
                    });
                }
            }
            else
            {
                ColumnsList.Clear();
                var comparison = SettingsHelper.ParseString(element["Comparison"]);
                if (SettingsHelper.ParseBool(element["ShowSplitTimes"]))
                {
                    ColumnsList.Add(new ColumnSettings(CurrentState, "+/-", ColumnsList)
                    {
                        Data = new ColumnData("+/-", ColumnType.Delta, comparison, "Current Timing Method")
                    });
                    ColumnsList.Add(new ColumnSettings(CurrentState, "Time", ColumnsList)
                    {
                        Data = new ColumnData("Time", ColumnType.SplitTime, comparison, "Current Timing Method")
                    });
                }
                else
                {
                    ColumnsList.Add(new ColumnSettings(CurrentState, "+/-", ColumnsList)
                    {
                        Data = new ColumnData("+/-", ColumnType.DeltaorSplitTime, comparison, "Current Timing Method")
                    });
                }
            }
            if (version >= new Version(1, 3))
            {
                BeforeNamesColor  = SettingsHelper.ParseColor(element["BeforeNamesColor"]);
                CurrentNamesColor = SettingsHelper.ParseColor(element["CurrentNamesColor"]);
                AfterNamesColor   = SettingsHelper.ParseColor(element["AfterNamesColor"]);
                OverrideTextColor = SettingsHelper.ParseBool(element["OverrideTextColor"]);
            }
            else
            {
                if (version >= new Version(1, 2))
                {
                    BeforeNamesColor = CurrentNamesColor = AfterNamesColor = SettingsHelper.ParseColor(element["SplitNamesColor"]);
                }
                else
                {
                    BeforeNamesColor  = Color.FromArgb(255, 255, 255);
                    CurrentNamesColor = Color.FromArgb(255, 255, 255);
                    AfterNamesColor   = Color.FromArgb(255, 255, 255);
                }
                OverrideTextColor = !SettingsHelper.ParseBool(element["UseTextColor"], true);
            }
        }
コード例 #6
0
        public void SetSettings(XmlNode node)
        {
            var     element = (XmlElement)node;
            Version version = SettingsHelper.ParseVersion(element["Version"]);

            VisualSplitCount       = SettingsHelper.ParseInt(element["VisualSplitCount"]);
            SplitPreviewCount      = SettingsHelper.ParseInt(element["SplitPreviewCount"]);
            ShowThinSeparators     = SettingsHelper.ParseBool(element["ShowThinSeparators"]);
            AlwaysShowLastSplit    = SettingsHelper.ParseBool(element["AlwaysShowLastSplit"]);
            SplitWidth             = SettingsHelper.ParseFloat(element["SplitWidth"]);
            AutomaticAbbreviations = SettingsHelper.ParseBool(element["AutomaticAbbreviations"], false);
            ShowColumnLabels       = SettingsHelper.ParseBool(element["ShowColumnLabels"], false);
            LabelsColor            = SettingsHelper.ParseColor(element["LabelsColor"], Color.FromArgb(255, 255, 255));
            OverrideTimesColor     = SettingsHelper.ParseBool(element["OverrideTimesColor"], false);
            BeforeTimesColor       = SettingsHelper.ParseColor(element["BeforeTimesColor"], Color.FromArgb(255, 255, 255));
            CurrentTimesColor      = SettingsHelper.ParseColor(element["CurrentTimesColor"], Color.FromArgb(255, 255, 255));
            AfterTimesColor        = SettingsHelper.ParseColor(element["AfterTimesColor"], Color.FromArgb(255, 255, 255));
            SplitHeight            = SettingsHelper.ParseFloat(element["SplitHeight"], 6);
            SeparatorLastSplit     = SettingsHelper.ParseBool(element["SeparatorLastSplit"], true);
            DropDecimals           = SettingsHelper.ParseBool(element["DropDecimals"], true);
            DeltasAccuracy         = SettingsHelper.ParseEnum(element["DeltasAccuracy"], TimeAccuracy.Tenths);
            OverrideDeltasColor    = SettingsHelper.ParseBool(element["OverrideDeltasColor"], false);
            DeltasColor            = SettingsHelper.ParseColor(element["DeltasColor"], Color.FromArgb(255, 255, 255));
            Display2Rows           = SettingsHelper.ParseBool(element["Display2Rows"], false);
            SplitTimesAccuracy     = SettingsHelper.ParseEnum(element["SplitTimesAccuracy"], TimeAccuracy.Seconds);
            ShowBlankSplits        = SettingsHelper.ParseBool(element["ShowBlankSplits"], true);
            LockLastSplit          = SettingsHelper.ParseBool(element["LockLastSplit"], false);
            SplitsLabel            = SettingsHelper.ParseString(element["SplitsLabel"], "Splits");

            //Title
            ShowTitle             = SettingsHelper.ParseBool(element["ShowTitle"], false);
            ShowGameName          = SettingsHelper.ParseBool(element["ShowGameName"], false);
            ShowCategoryName      = SettingsHelper.ParseBool(element["ShowCategoryName"], false);
            ShowFinishedRunsCount = SettingsHelper.ParseBool(element["ShowFinishedRunsCount"], false);
            ShowAttemptCount      = SettingsHelper.ParseBool(element["ShowAttemptCount"], false);
            DisplayGameIcon       = SettingsHelper.ParseBool(element["DisplayGameIcon"], false);
            CenterTitle           = SettingsHelper.ParseBool(element["CenterTitle"], false);
            ShowRegion            = SettingsHelper.ParseBool(element["ShowRegion"], false);
            ShowPlatform          = SettingsHelper.ParseBool(element["ShowPlatform"], false);
            ShowVariables         = SettingsHelper.ParseBool(element["ShowVariables"], false);

            if (version >= new Version(1, 5))
            {
                var columnsElement = element["Columns"];
                ColumnsList.Clear();
                foreach (var child in columnsElement.ChildNodes)
                {
                    var columnData = ColumnData.FromXml((XmlNode)child);
                    ColumnsList.Add(new ColumnSettings(CurrentState, columnData.Name, ColumnsList)
                    {
                        Data = columnData
                    });
                }
            }
            else
            {
                ColumnsList.Clear();
                var comparison = SettingsHelper.ParseString(element["Comparison"]);
                if (SettingsHelper.ParseBool(element["ShowSplitTimes"]))
                {
                    ColumnsList.Add(new ColumnSettings(CurrentState, "+/-", ColumnsList)
                    {
                        Data = new ColumnData("+/-", ColumnType.Delta, comparison, "Current Timing Method")
                    });
                    ColumnsList.Add(new ColumnSettings(CurrentState, "Time", ColumnsList)
                    {
                        Data = new ColumnData("Time", ColumnType.SplitTime, comparison, "Current Timing Method")
                    });
                }
                else
                {
                    ColumnsList.Add(new ColumnSettings(CurrentState, "+/-", ColumnsList)
                    {
                        Data = new ColumnData("+/-", ColumnType.DeltaorSplitTime, comparison, "Current Timing Method")
                    });
                }
            }
            if (version >= new Version(1, 3))
            {
                BeforeNamesColor  = SettingsHelper.ParseColor(element["BeforeNamesColor"]);
                CurrentNamesColor = SettingsHelper.ParseColor(element["CurrentNamesColor"]);
                AfterNamesColor   = SettingsHelper.ParseColor(element["AfterNamesColor"]);
                OverrideTextColor = SettingsHelper.ParseBool(element["OverrideTextColor"]);
            }
            else
            {
                if (version >= new Version(1, 2))
                {
                    BeforeNamesColor = CurrentNamesColor = AfterNamesColor = SettingsHelper.ParseColor(element["SplitNamesColor"]);
                }
                else
                {
                    BeforeNamesColor  = Color.FromArgb(255, 255, 255);
                    CurrentNamesColor = Color.FromArgb(255, 255, 255);
                    AfterNamesColor   = Color.FromArgb(255, 255, 255);
                }
                OverrideTextColor = !SettingsHelper.ParseBool(element["UseTextColor"], true);
            }
        }
コード例 #7
0
        public void SetSettings(XmlNode node)
        {
            var     element = (XmlElement)node;
            Version version;

            if (element["Version"] != null)
            {
                version = Version.Parse(element["Version"].InnerText);
            }
            else
            {
                version = new Version(1, 0, 0, 0);
            }
            CurrentSplitTopColor    = ParseColor(element["CurrentSplitTopColor"]);
            CurrentSplitBottomColor = ParseColor(element["CurrentSplitBottomColor"]);
            VisualSplitCount        = Int32.Parse(element["VisualSplitCount"].InnerText);
            SplitPreviewCount       = Int32.Parse(element["SplitPreviewCount"].InnerText);
            DisplayIcons            = Boolean.Parse(element["DisplayIcons"].InnerText);
            ShowThinSeparators      = Boolean.Parse(element["ShowThinSeparators"].InnerText);
            AlwaysShowLastSplit     = Boolean.Parse(element["AlwaysShowLastSplit"].InnerText);
            SplitWidth = Single.Parse(element["SplitWidth"].InnerText.Replace(',', '.'), CultureInfo.InvariantCulture);

            if (version >= new Version(1, 5))
            {
                HideIconsIfAllBlank = Boolean.Parse(element["HideIconsIfAllBlank"].InnerText);
                ShowColumnLabels    = Boolean.Parse(element["ShowColumnLabels"].InnerText);
                LabelsColor         = ParseColor(element["LabelsColor"]);
                var columnsElement = element["Columns"];
                ColumnsList.Clear();
                foreach (var child in columnsElement.ChildNodes)
                {
                    var columnData = ColumnData.FromXml((XmlNode)child);
                    ColumnsList.Add(new ColumnSettings(CurrentState, columnData.Name, ColumnsList)
                    {
                        Data = columnData
                    });
                }
            }
            else
            {
                HideIconsIfAllBlank = true;
                ShowColumnLabels    = false;
                LabelsColor         = Color.FromArgb(255, 255, 255);
                ColumnsList.Clear();
                var comparison = element["Comparison"].InnerText;
                if (Boolean.Parse(element["ShowSplitTimes"].InnerText))
                {
                    ColumnsList.Add(new ColumnSettings(CurrentState, "+/-", ColumnsList)
                    {
                        Data = new ColumnData("+/-", ColumnType.Delta, comparison, "Current Timing Method")
                    });
                    ColumnsList.Add(new ColumnSettings(CurrentState, "Time", ColumnsList)
                    {
                        Data = new ColumnData("Time", ColumnType.SplitTime, comparison, "Current Timing Method")
                    });
                }
                else
                {
                    ColumnsList.Add(new ColumnSettings(CurrentState, "+/-", ColumnsList)
                    {
                        Data = new ColumnData("+/-", ColumnType.DeltaorSplitTime, comparison, "Current Timing Method")
                    });
                }
            }
            if (version >= new Version(1, 3))
            {
                OverrideTimesColor  = Boolean.Parse(element["OverrideTimesColor"].InnerText);
                BeforeTimesColor    = ParseColor(element["BeforeTimesColor"]);
                CurrentTimesColor   = ParseColor(element["CurrentTimesColor"]);
                AfterTimesColor     = ParseColor(element["AfterTimesColor"]);
                BeforeNamesColor    = ParseColor(element["BeforeNamesColor"]);
                CurrentNamesColor   = ParseColor(element["CurrentNamesColor"]);
                AfterNamesColor     = ParseColor(element["AfterNamesColor"]);
                SplitHeight         = Single.Parse(element["SplitHeight"].InnerText.Replace(',', '.'), CultureInfo.InvariantCulture);
                SplitGradientString = element["CurrentSplitGradient"].InnerText;
                BackgroundColor     = ParseColor(element["BackgroundColor"]);
                BackgroundColor2    = ParseColor(element["BackgroundColor2"]);
                GradientString      = element["BackgroundGradient"].InnerText;
                SeparatorLastSplit  = Boolean.Parse(element["SeparatorLastSplit"].InnerText);
                DropDecimals        = Boolean.Parse(element["DropDecimals"].InnerText);
                DeltasAccuracy      = ParseEnum <TimeAccuracy>(element["DeltasAccuracy"]);
                OverrideDeltasColor = Boolean.Parse(element["OverrideDeltasColor"].InnerText);
                DeltasColor         = ParseColor(element["DeltasColor"]);
                Display2Rows        = Boolean.Parse(element["Display2Rows"].InnerText);
            }
            else
            {
                if (version >= new Version(1, 2))
                {
                    BeforeNamesColor = CurrentNamesColor = AfterNamesColor = ParseColor(element["SplitNamesColor"]);
                }
                else
                {
                    BeforeNamesColor  = Color.FromArgb(255, 255, 255);
                    CurrentNamesColor = Color.FromArgb(255, 255, 255);
                    AfterNamesColor   = Color.FromArgb(255, 255, 255);
                }
                BeforeTimesColor     = Color.FromArgb(255, 255, 255);
                CurrentTimesColor    = Color.FromArgb(255, 255, 255);
                AfterTimesColor      = Color.FromArgb(255, 255, 255);
                OverrideTimesColor   = false;
                SplitHeight          = 6;
                CurrentSplitGradient = GradientType.Vertical;
                BackgroundColor      = Color.Transparent;
                BackgroundColor2     = Color.Transparent;
                BackgroundGradient   = ExtendedGradientType.Plain;
                SeparatorLastSplit   = true;
                DropDecimals         = true;
                DeltasAccuracy       = TimeAccuracy.Tenths;
                OverrideDeltasColor  = false;
                DeltasColor          = Color.FromArgb(255, 255, 255);
                Display2Rows         = false;
            }
            if (version >= new Version(1, 2))
            {
                SplitTimesAccuracy = ParseEnum <TimeAccuracy>(element["SplitTimesAccuracy"]);
                if (version >= new Version(1, 3))
                {
                    OverrideTextColor = Boolean.Parse(element["OverrideTextColor"].InnerText);
                }
                else
                {
                    OverrideTextColor = !Boolean.Parse(element["UseTextColor"].InnerText);
                }
                ShowBlankSplits = Boolean.Parse(element["ShowBlankSplits"].InnerText);
                LockLastSplit   = Boolean.Parse(element["LockLastSplit"].InnerText);
                IconSize        = Single.Parse(element["IconSize"].InnerText.Replace(',', '.'), CultureInfo.InvariantCulture);
                IconShadows     = Boolean.Parse(element["IconShadows"].InnerText);
            }
            else
            {
                SplitTimesAccuracy = TimeAccuracy.Seconds;
                OverrideTextColor  = false;
                ShowBlankSplits    = true;
                LockLastSplit      = false;
                IconSize           = 24f;
                IconShadows        = true;
            }
        }