Exemplo n.º 1
0
        public LegalitySubsystem(
            DropDown menuLegalityFormat,
            ButtonBase buttonLegalityAllowLegal,
            ButtonBase buttonLegalityAllowRestricted,
            ButtonBase buttonLegalityAllowBanned,
            ButtonBase buttonLegalityAllowFuture)
        {
            _menuLegalityFormat = menuLegalityFormat;
            _menuLegalityFormat.SetMenuValues(Legality.Formats.Prepend(Legality.AnyFormat));

            _buttonLegalityAllowLegal      = buttonLegalityAllowLegal;
            _buttonLegalityAllowRestricted = buttonLegalityAllowRestricted;
            _buttonLegalityAllowBanned     = buttonLegalityAllowBanned;
            _buttonLegalityAllowFuture     = buttonLegalityAllowFuture;
        }
Exemplo n.º 2
0
        private void setMenuMode(ButtonBase sender)
        {
            _menuOpen.SuspendLayout();

            foreach (var state in _saveLoadMenuModes)
            {
                state.IsCurrent = state.TitleButton == sender;

                if (state.IsCurrent)
                {
                    _buttonImportExportToMtgArena.Text = state.MtgArenaButtonText;
                }

                foreach (var menuButton in state.MenuButtons)
                {
                    menuButton.Visible = state.IsCurrent;
                }
            }

            _buttonRestoreCollection.Enabled = _uiConfigRepository.Config.CollectionBeforeImportMtga != null;

            _menuOpen.ResumeLayout(false);
            _menuOpen.PerformLayout();
        }
Exemplo n.º 3
0
        private void loadReport(ButtonBase button)
        {
            ReportSettings settings = null;

            if (button == _buttonManaCurveType || button == _buttonManaCurveManacost)
            {
                settings = new ReportSettings
                {
                    DataSource       = DataSource.Deck,
                    SeriesFieldsSort = new List <SortOrder> {
                        SortOrder.Ascending
                    },
                    ColumnFields = new List <string> {
                        nameof(Card.Cmc)
                    },
                    ColumnFieldsSort = new List <SortOrder> {
                        SortOrder.Ascending
                    },
                    SummaryFields = new List <string> {
                        nameof(Card.DeckCount)
                    },
                    SummaryFunctions = new List <string> {
                        Aggregates.Sum
                    },
                    ChartType         = SeriesChartType.StackedColumn,
                    LabelDataElement  = DataElement.Series,
                    ShowArgumentTotal = true
                };

                if (button == _buttonManaCurveType)
                {
                    settings.SeriesFields = new List <string> {
                        nameof(Card.Types)
                    }
                }
                ;
                else if (button == _buttonManaCurveManacost)
                {
                    settings.SeriesFields = new List <string> {
                        nameof(Card.Color)
                    }
                }
                ;
            }
            else if (button == _buttonDeckPrice || button == _buttonCollectionPrice)
            {
                settings = new ReportSettings
                {
                    ColumnFields = new List <string> {
                        nameof(Card.NameEn)
                    },
                    SummaryFunctions = new List <string> {
                        Aggregates.Sum, Aggregates.Sum
                    },
                    SummarySort = new List <SortOrder> {
                        SortOrder.Descending, SortOrder.None
                    },
                    LabelDataElement = DataElement.SummaryField,
                    ChartType        = (SeriesChartType)Enum.Parse(typeof(SeriesChartType), _menuPriceChartType.SelectedValue)
                };

                if (button == _buttonDeckPrice)
                {
                    settings.SummaryFields = getPriceSummaryFields(_deckPriceTotalFields);
                    settings.DataSource    = DataSource.Deck;
                }
                else if (button == _buttonCollectionPrice)
                {
                    settings.SummaryFields = getPriceSummaryFields(_collectionPriceTotalFields);
                    settings.DataSource    = DataSource.Collection;
                }
                else
                {
                    throw new Exception("Logical error");
                }

                if (!ChartTypeMetadata.ByType[settings.ChartType].CanDisplayMultipleSeries)
                {
                    settings.SummaryFields.RemoveAt(1);
                    settings.SummarySort.RemoveAt(1);
                    settings.SummaryFunctions.RemoveAt(1);

                    settings.LabelDataElement = DataElement.Argument;
                }
            }
            else if (button == _buttonDeckColors || button == _buttonCollectionColors)
            {
                settings = new ReportSettings
                {
                    SeriesFields = new List <string> {
                        nameof(Card.Types)
                    },
                    SeriesFieldsSort = new List <SortOrder> {
                        SortOrder.Ascending
                    },
                    ColumnFields = new List <string> {
                        nameof(Card.Color)
                    },
                    ColumnFieldsSort = new List <SortOrder> {
                        SortOrder.Ascending
                    },
                    SummaryFunctions = new List <string> {
                        Aggregates.Sum
                    },
                    ChartType         = SeriesChartType.StackedColumn,
                    LabelDataElement  = DataElement.Series,
                    ShowArgumentTotal = true
                };

                if (button == _buttonDeckColors)
                {
                    settings.SummaryFields = new List <string> {
                        nameof(Card.DeckCount)
                    };
                    settings.DataSource = DataSource.Deck;
                }
                else if (button == _buttonCollectionColors)
                {
                    settings.SummaryFields = new List <string> {
                        nameof(Card.CollectionCount)
                    };
                    settings.DataSource = DataSource.Collection;
                }
            }

            if (settings != null)
            {
                Title = button.Text;
                buildChart(settings);
            }
        }