Example #1
0
        public IActionResult EditCombo(int ComboId, ComboView InputEdit)
        {
            var comboToEdit = _context.Combos
                              .Include(i => i.Inputs)
                              .SingleOrDefault(c => c.ComboId == ComboId);

            if (comboToEdit.Type != null)
            {
                try
                {
                    comboToEdit.Difficulty = InputEdit.Difficulty;
                    comboToEdit.Type       = InputEdit.Type;
                    comboToEdit.Inputs     = InputEdit.Inputs;
                    _context.SaveChanges();

                    return(RedirectToAction("Detail"));
                }
                catch (DbUpdateException ex)
                {
                    //Log the error (uncomment ex variable name and write a log.)
                    ModelState.AddModelError("", "Unable to save changes. " +
                                             "Try again, and if the problem persists, " +
                                             "see your system administrator.");
                    return(RedirectToAction("Detail", ex));
                }
            }
            return(View("Detail"));
        }
Example #2
0
        /// <summary>
        /// 起動時のイベントハンドラ
        /// </summary>
        /// <param name="e">イベント引数</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            Instance = this;

            // YKToolkit.Controls のリソースをロードするために先に初期化する必要がある
            YKToolkit.Controls.ThemeManager.Instance.Initialize();

            this.DispatcherUnhandledException += OnDispatcherUnhandledException;
            this.SessionEnding  += OnSessionEnding;
            this.ShutdownMode    = ShutdownMode.OnExplicitShutdown;
            this.IsPoppinEnabled = true;

            // KeyView のインスタンスを倉庫に詰める
            Enumerable.Range(0, MaxViewCount).ToList().ForEach(x =>
            {
                this._keyViews.Add(new KeyView());
            });

            // 出庫した分のインスタンスを倉庫に詰め直す
            //this._keyViewTimer.Elapsed += (_, __) =>
            //{
            //    if (this._keyViews.Count < MaxViewCount)
            //    {
            //        this.Dispatcher.BeginInvoke((Action)(() =>
            //        {
            //            Enumerable.Range(0, MaxViewCount - this._keyViews.Count).ToList().ForEach(x =>
            //            {
            //                this._keyViews.Add(new KeyView());
            //            });
            //        }), DispatcherPriority.SystemIdle, null);
            //    }
            //};
            //this._keyViewTimer.Start();

            KeyConf.Current.LoadConf();
            KeyCollector.Current.KeyUp += OnKeyUp;

            // DPI 取得
            var dpiXProperty = typeof(SystemParameters).GetProperty("DpiX", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
            var dpiYProperty = typeof(SystemParameters).GetProperty("Dpi", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);

            this.DpiX            = (int)dpiXProperty.GetValue(null, null);
            this.DpiY            = (int)dpiYProperty.GetValue(null, null);
            this.MinimumDistance = new User32.POINT(1, 1).CalcDistance(new User32.POINT());

            // 変数宣言時に new すると YKToolkit.Controls のリソースが反映されないウィンドウができあがってしまうのでここで new する
            this._logView = new LogView()
            {
                DataContext = new LogViewModel()
            };

            var w = new ComboView();

            w.DataContext = new ComboViewModel();
            w.Show();
        }
Example #3
0
        public IActionResult ComboEdit(int ComboId)
        {
            var combo = _context.Combos
                        .Include(i => i.Inputs)
                        .SingleOrDefault(c => c.ComboId == ComboId);

            var ComboView = new ComboView()
            {
                ComboId    = combo.ComboId,
                Difficulty = combo.Difficulty,
                Type       = combo.Type,
                Inputs     = combo.Inputs
            };

            return(View("AddEditCombo", ComboView));
        }
Example #4
0
        public IActionResult AddCombo(string CharacterId, ComboView combo)
        {
            if (combo == null)
            {
                return(new NotFoundObjectResult(HttpStatusCode.BadRequest));
            }
            var character = _context.Characters
                            .Include(c => c.Moves)
                            .ThenInclude(i => i.Inputs)
                            .Include(c => c.Combos)
                            .ThenInclude(i => i.Inputs)
                            .SingleOrDefault(c => c.CharacterId == CharacterId);

            var newCombo = new Combo()
            {
                Inputs     = combo.Inputs,
                Type       = combo.Type,
                Difficulty = combo.Difficulty
            };

            character.Combos.Add(newCombo);
            return(RedirectToAction("Detail"));
        }
Example #5
0
        public IActionResult ComboAdd()
        {
            var ComboView = new ComboView();

            return(View("AddEditCombo", ComboView));
        }
Example #6
0
 public static void Destroy(this ComboView combo)
 {
     ComboPool.Instance.Destroy(combo);
 }