Ejemplo n.º 1
0
        /// <param name="checks">コンテスト設定データ</param>
        public ItemEditor(CheckInfo checks)
        {
            Result   = null;
            firstTmp = checks;
            InitializeComponent();

            this.Title = "Edit: " + checks.Name + "(" + checks.Rem + ")";
            switch (checks.Mode)
            {
            case SetMode.String:
                var estring = new EditString(checks);
                GdEditor.Children.Add(estring);
                editor      = estring;
                this.Height = 130;
                break;

            case SetMode.Terms:
                var eterms = new EditTerms(checks);
                GdEditor.Children.Add(eterms);
                editor      = eterms;
                this.Height = 400;
                this.Width  = 370;
                break;

            case SetMode.Frequency:
                var efreq = new EditFreq(checks);
                GdEditor.Children.Add(efreq);
                editor      = efreq;
                this.Height = 350;
                this.Width  = 260;
                break;

            case SetMode.PowerMode:
                var emode = new EditPowerMode(checks);
                GdEditor.Children.Add(emode);
                editor      = emode;
                this.Height = 250;
                this.Width  = 300;
                break;

            case SetMode.Sector:
                var esect = new EditSectors(checks);
                GdEditor.Children.Add(esect);
                editor     = esect;
                this.Width = 900;
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            string      ErrorStr = "";
            IItemEditor iie;

            foreach (var gc in Generals)
            {
                iie = null;

                switch (gc.Mode)
                {
                case SetMode.String:
                    iie = new EditString(gc);
                    break;

                case SetMode.Terms:
                    iie = new EditTerms(gc);
                    break;

                case SetMode.Frequency:
                    iie = new EditFreq(gc);
                    break;

                case SetMode.PowerMode:
                    iie = new EditPowerMode(gc);
                    break;

                case SetMode.Sector:
                    iie = new EditSectors(gc);
                    break;

                default:
                    break;
                }

                if (iie == null)
                {
                    continue;
                }

                if (!iie.IsNotInvalid() && !gc.Data.IsEmpty())
                {
                    ErrorStr += gc.Name + " / 「" + iie.ErrorStr + "」\r\n";
                }
            }

            if (ErrorStr.Length > 0)
            {
                MessageBox.Show(ErrorStr);
            }
            else
            {
#pragma warning disable IDE0017 // オブジェクトの初期化を簡略化します
                SaveFileDialog sfd = new SaveFileDialog();
#pragma warning restore IDE0017 // オブジェクトの初期化を簡略化します
                sfd.Title  = "集計設定ファイルの保存";
                sfd.Filter = "集計設定ファイル(*.scp.txt)|*.scp.txt";
                if (sfd.ShowDialog() == true)
                {
                    SaveAsJsons(sfd.FileName);
                }
            }
        }