Esempio n. 1
0
 public GoodsViewModel()
 {
     inputCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
     {
         var w = new InputWindow();
         w.ShowDialog();
     });
     outputCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
     {
         OutputWindow w = new OutputWindow();
         w.ShowDialog();
     });
     productCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
     {
         ProductWindow w = new ProductWindow();
         w.ShowDialog();
     });
     categoryCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
     {
         CategoryWindow w = new CategoryWindow();
         w.ShowDialog();
     });
     statisticCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
     {
         StatisticWindow w = new StatisticWindow();
         w.ShowDialog();
     });
 }
Esempio n. 2
0
        private void Create_Click(object sender, RoutedEventArgs e)
        {
            CategoryWindow cw = new CategoryWindow();

            cw.CallbackAction = async() => { await LoadData(); };
            cw.Show();
        }
Esempio n. 3
0
    public void Init(CategoryInfo info, int index, CategoryWindow p)
    {
        // initilize the sprite first
        URLRequestMessage msg = new URLRequestMessage(this);

        msg.url = info.bgUrl;
        VREvents.FireRequesTexture(msg);

        parent    = p;
        text.text = info.name;
        m_info    = info;

        img.DOFade(0, 0);
        text.DOFade(0, 0);
        text.text = "";

        PlayInitAnimation();

        //set the angle and position offset
        float angle = m_setting.anglePerUnit * ((index % parent.column) - (parent.column - 1f) / 2f);

        transform.localRotation = Quaternion.Euler(0, angle, 0);
        Vector3 pos = transform.localPosition;

        pos.z = (Mathf.Cos(angle * Mathf.Deg2Rad) - 1) * m_setting.radius;
        transform.localPosition = pos;

        ResetSubButton();
    }
Esempio n. 4
0
        private void addCategoryBtn(object sender, RoutedEventArgs e)
        {
            CategoryWindow categoryWindow = new CategoryWindow();

            categoryWindow.Closed += new EventHandler(categoryWindow_Closed);
            categoryWindow.Show();
        }
Esempio n. 5
0
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            Category       c  = ((FrameworkElement)sender).DataContext as Category;
            CategoryWindow cw = new CategoryWindow();

            cw.SetCategoryId(c.CategoryId);
            cw.CallbackAction = async() => { await LoadData(); };
            cw.Show();
        }
Esempio n. 6
0
        public void NewGame(object param)
        {
            user.GameProperty = new Game();
            CategoryWindow    window     = new CategoryWindow();
            CategoryViewModel categoryVM = new CategoryViewModel(user);

            window.DataContext = categoryVM;
            App.Current.MainWindow.Close();
            App.Current.MainWindow = window;
            window.Show();
        }
Esempio n. 7
0
        /// <summary>
        /// カテゴリ編集クリック時の処理
        /// </summary>
        private void EditCategoryClick()
        {
            var window = new CategoryWindow()
            {
                Owner = this._window
            };

            if (true != window.ShowDialog())
            {
                return;
            }
        }
        private void AddCategoryCommandExecute(object obj)
        {
            CategoryWindow window = container.Resolve <CategoryWindow>(new ResolverOverride[]
            {
                new ParameterOverride("actionCode", 1)
            });

            window.Owner = (obj as Window);
            bool result = (bool)window.ShowDialog();

            if (result)
            {
                var category = (window.DataContext as CategoryWindowViewModel).DataFormCategory;
                DataFormCategories.Add(category);
            }
        }
        private void RemoveCategoryCommandExecute(object obj)
        {
            CategoryWindow window = container.Resolve <CategoryWindow>(new ResolverOverride[]
            {
                new ParameterOverride("actionCode", 3)
            });

            window.Owner = (obj as Window);
            bool result = (bool)window.ShowDialog();

            if (result)
            {
                var removedCategory = (window.DataContext as CategoryWindowViewModel).DataFormCategory;
                var current         = DataFormCategories.Where(s => s.CategoryId == removedCategory.CategoryId).FirstOrDefault();
                if (current != null)
                {
                    DataFormCategories.Remove(current);
                }
            }
        }
        private void UpdateCategoryCommandExecute(object obj)
        {
            CategoryWindow window = container.Resolve <CategoryWindow>(new ResolverOverride[]
            {
                new ParameterOverride("actionCode", 2)
            });

            window.Owner = (obj as Window);
            bool result = (bool)window.ShowDialog();

            if (result)
            {
                var update  = (window.DataContext as CategoryWindowViewModel).DataFormCategory;
                var current = DataFormCategories.Where(s => s.CategoryId == update.CategoryId).FirstOrDefault();
                if (current != null)
                {
                    current.CategoryName = update.CategoryName;
                    current.Description  = update.Description;
                }
            }
        }
Esempio n. 11
0
        public void AddUserAndPlay(object param)
        {
            if (!HangmanValidators.CanAddUser(NameTextBox, users))
            {
                MessageBox.Show("This nickname is taken.");
                return;
            }
            int  imageIndex = images.Emojis.IndexOf(ImageSource);
            User user       = new User(NameTextBox, imageIndex);

            user.GameProperty = new Game();
            users.List.Add(new User(NameTextBox, imageIndex));
            serializationActions.SerializeUsers(Constants.UsersFile, users);
            CategoryWindow    categoryWindow = new CategoryWindow();
            CategoryViewModel categoryVM     = new CategoryViewModel(user, true);

            categoryWindow.DataContext = categoryVM;
            App.Current.MainWindow.Close();
            App.Current.MainWindow = categoryWindow;
            categoryWindow.Show();
        }
Esempio n. 12
0
        private void ShowMessageBox(string title, string details, MessageBoxImage messageBoxImage)
        {
            StopTimer();
            MessageBoxResult messageBoxResult = MessageBox.Show(details, title, MessageBoxButton.YesNo, messageBoxImage);

            if (messageBoxResult == MessageBoxResult.Yes)
            {
                Level = user.GameProperty.LevelProperty = 1;
                ReloadGame();
            }
            else
            {
                user.GameProperty.MistakesProperty = 0;
                user.GameProperty.LevelProperty    = 1;
                CategoryWindow    categoryWindow = new CategoryWindow();
                CategoryViewModel categoryVM     = new CategoryViewModel(user);
                categoryWindow.DataContext = categoryVM;
                App.Current.MainWindow.Close();
                App.Current.MainWindow = categoryWindow;
                categoryWindow.Show();
            }
        }
Esempio n. 13
0
        public void ShowSettings()
        {
            var panels = new List <CategoryPanel>
            {
                new GeneralOptionsPanel(),
                new AboutOptionsPanel()
            };

            if (_optionsWindow == null)
            {
                _optionsWindow         = new CategoryWindow(null, panels, Resources.ResourceManager, "OptionsWindow");
                _optionsWindow.Closed += (o, args) => { _optionsWindow = null; };
            }

            var dialogResult = _optionsWindow.ShowDialog();

            if (dialogResult.HasValue && dialogResult.Value)
            {
                Settings.Default.Save();

                Refresh();
            }
        }
Esempio n. 14
0
        void category_Button_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var categoryWindow = new CategoryWindow();

            categoryWindow.Show();
        }
Esempio n. 15
0
        private void addCategory(object sender, EventArgs e)
        {
            CategoryWindow category = new CategoryWindow();

            category.Show();
        }
Esempio n. 16
0
        public void NewPressed(object param)
        {
            int seconds = (deadline - DateTime.Now).Seconds;

            StopTimer();
            MessageBoxResult messageBoxResult = MessageBox.Show("If you start a new game this game will count as lost.\nAre you sure you want to start a new game?", "New game", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (messageBoxResult == MessageBoxResult.Yes)
            {
                user.GameProperty.MistakesProperty = 0;
                user.GameProperty.LevelProperty    = 1;
                switch (user.GameProperty.CategoryProperty)
                {
                case Category.All:
                    user.StatisticsProperty.LostGamesAll += 1;
                    break;

                case Category.Cars:
                    user.StatisticsProperty.LostGamesCars += 1;
                    break;

                case Category.Movies:
                    user.StatisticsProperty.LostGamesMovies += 1;
                    break;

                case Category.States:
                    user.StatisticsProperty.LostGamesStates += 1;
                    break;

                case Category.Mountains:
                    user.StatisticsProperty.LostGamesMountains += 1;
                    break;

                case Category.Rivers:
                    user.StatisticsProperty.LostGamesRivers += 1;
                    break;

                default:
                    break;
                }
                foreach (var userInList in users.List)
                {
                    if (userInList.Name == user.Name)
                    {
                        userInList.StatisticsProperty = user.StatisticsProperty;
                        if (resumeGame)
                        {
                            userInList.GameProperty = new Game();
                        }
                    }
                }
                serializationActions.SerializeUsers(Constants.UsersFile, users);
                CategoryWindow    categoryWindow = new CategoryWindow();
                CategoryViewModel categoryVM     = new CategoryViewModel(user);
                categoryWindow.DataContext = categoryVM;
                App.Current.MainWindow.Close();
                App.Current.MainWindow = categoryWindow;
                categoryWindow.Show();
            }
            else
            {
                StartTimer(seconds);
            }
        }