Exemple #1
0
        private void update_base_input()
        {
            // Close this window
            if (Global.Input.triggered(Inputs.B))
            {
                Global.game_system.play_se(System_Sounds.Cancel);
                close();
            }

            // Select unit
            var selected_index = UnitWindow.consume_triggered(
                Inputs.A, MouseButtons.Left, TouchGestures.Tap);

            if (selected_index.IsSomething)
            {
                Global.game_system.play_se(System_Sounds.Confirm);
                select_unit();
            }

            // Status screen
            var status_index = UnitWindow.consume_triggered(
                Inputs.R, MouseButtons.Right, TouchGestures.LongPress);

            if (status_index.IsSomething)
            {
                Global.game_system.play_se(System_Sounds.Confirm);
                OnStatus(new EventArgs());
            }
        }
Exemple #2
0
        public MainViewModel()
        {
            LoadedWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => {
                IsLoaded = true;
                LoginWindow loginWindow = new LoginWindow();
                loginWindow.ShowDialog();
            });

            //MessageBox.Show("Đã vào trong MainViewModel -> DataContext của mainwindow.xaml");
            UnitCommand = new RelayCommand <object>((p) => { return(true); }, (p) => {
                UnitWindow wd = new UnitWindow();
                wd.ShowDialog();
            });
            //
            SuplierCommand = new RelayCommand <object>((p) => { return(true); }, (p) => {
                SuplierWindow wd = new SuplierWindow();
                wd.ShowDialog();
            });
            //
            CustomerCommand = new RelayCommand <object>((p) => { return(true); }, (p) => {
                CustomerWindow wd = new CustomerWindow();
                wd.ShowDialog();
            });
            //
        }
        public void AnimateRemoveUnit(UnitWindow removeUnit, System.Action endAnimEvent)
        {
            animDelete        = new AnimFloat(0f);
            animDelete.target = 1f;
            animDelete.speed  = 1.5f;
            animDelete.valueChanged.AddListener(Repaint);
            animDelete.valueChanged.AddListener(
                () =>
            {
                removeUnit.visibleScale = animDelete.value;
            }
                );

            someEvent.AddEvent(
                () =>
            {
                return(animDelete.value > 0.95f);
            },
                () =>
            {
                if (endAnimEvent != null)
                {
                    endAnimEvent();
                }
            }
                );
        }
 private void InitializeUnitWindowCommand()
 {
     UnitWindowCommand = new RelayCommand <object>(
         sender => { return(true); }, sender =>
     {
         UnitWindow unitWindow = new UnitWindow();
         unitWindow.ShowDialog();
     });
 }
        public MainViewModel()
        {
            IsLoaded = false;

            LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) =>
            {
                IsLoaded = true;

                if (p == null)
                {
                    return;
                }

                p.Hide();
                LoginWindow loginWindow = new LoginWindow();
                loginWindow.ShowDialog();

                if (loginWindow.DataContext == null)
                {
                    return;
                }

                var loginVM = loginWindow.DataContext as LoginViewModel;

                if (loginVM.IsLogin)
                {
                    p.Show();
                }
                else
                {
                    p.Close();
                }
            });

            UnitCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
            {
                UnitWindow window = new UnitWindow();
                window.ShowDialog();
            });

            SupplierCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
            {
                SupplierWindow window = new SupplierWindow();
                window.ShowDialog();
            });
        }
        private void ButtonAddItem_Click(object sender, RoutedEventArgs e)
        {
            if (ChaptersDataGrid.SelectedItem != null && ChaptersDataGrid.SelectedItem.ToString() != "{NewItemPlaceholder}")
            {
                this.edit = false;
                UnitWindow unitWindow = new UnitWindow(edit, selRow, index_capitulo);
                unitWindow.ShowDialog();

                clsUnitarios obj = new clsUnitarios();
                dt_unitarios = obj.CargarUnitarios(index_capitulo);

                dt_unitarios.Columns[0].ColumnName = "ITEM ID";
                dt_unitarios.Columns[1].ColumnName = "DESCRIPTION";
                dt_unitarios.Columns[2].ColumnName = "UNIT";
                dt_unitarios.Columns[3].ColumnName = "QUANTITY";
                dt_unitarios.Columns[4].ColumnName = "CHAPTER ID";

                ItemsDataGrid.ItemsSource = dt_unitarios.DefaultView;
            }
        }
        public MainWindowViewModel()
        {
            LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) =>
            {
                isLoaded = true;
                if (p == null)
                {
                    return;
                }
                p.Hide();
                LoginWindow loginWindow = new LoginWindow();
                loginWindow.ShowDialog();

                if (loginWindow.DataContext == null)
                {
                    return;
                }
                var loginVM = loginWindow.DataContext as LoginWindowViewModel;
                if (loginVM.IsLogin)
                {
                    p.Show();
                }
                else
                {
                    p.Close();
                }
            });

            OpenUnitWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
            {
                UnitWindow unitWindow = new UnitWindow();
                unitWindow.ShowDialog();
            });

            OpenSuppliersWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { SuppliersWindow sW = new SuppliersWindow(); sW.ShowDialog(); });
            OpenCustomersWindowCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CustomersWindow cW = new CustomersWindow(); cW.ShowDialog(); });
            OpenProductsWindowCommand  = new RelayCommand <object>((p) => { return(true); }, (p) => { ProductsWindow pW = new ProductsWindow(); pW.ShowDialog(); });
            OpenUsersWindowCommand     = new RelayCommand <object>((p) => { return(true); }, (p) => { UsersWindow pW = new UsersWindow(); pW.ShowDialog(); });
            OpenInputWindowCommand     = new RelayCommand <object>((p) => { return(true); }, (p) => { InputWindow pW = new InputWindow(); pW.ShowDialog(); });
            OpenOutputWindowCommand    = new RelayCommand <object>((p) => { return(true); }, (p) => { OutputWindow pW = new OutputWindow(); pW.ShowDialog(); });
        }
Exemple #8
0
        protected override void draw_window(SpriteBatch sprite_batch)
        {
            UnitWindow.draw(sprite_batch);
            DrawStatsWindow(sprite_batch);

            DrawHeader(sprite_batch);

            if (Item_Window_1 != null && !Using)
            {
                Item_Window_1.draw_help(sprite_batch);
            }

            sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            if (!Trading && !Unit_Selected)
            {
                ChooseUnitWindow.draw(sprite_batch);
                ChooseUnitLabel.draw(sprite_batch, -ChooseUnitWindow.loc);
            }
            sprite_batch.End();

            sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
            // Labels
            if (!Trading)
            {
                if (!Using)
                {
                    Funds_Banner.draw(sprite_batch);
                    Funds_Label.draw(sprite_batch);
                    Funds_G.draw(sprite_batch);
                    Funds_Value.draw(sprite_batch);
                    if (!Unit_Selected)
                    {
                        RButton.Draw(sprite_batch);
                    }
                }
            }
            // Data
            sprite_batch.End();
        }
Exemple #9
0
 // mọi thứ xử lý sẽ nằm trong này
 public MainViewModel()
 {
     LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) => {
         Isloaded = true;
         p.Hide();
         LoginWindow loginWindow = new LoginWindow();
         loginWindow.ShowDialog();
         p.Show();
     }
                                                     );
     UnitCommand     = new RelayCommand <object>((p) => { return(true); }, (p) => { UnitWindow wd = new UnitWindow(); wd.ShowDialog(); });
     SupplierCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { SupplierWindow wd = new SupplierWindow(); wd.ShowDialog(); });
     CustomerCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { CustomerWindow wd = new CustomerWindow(); wd.ShowDialog(); });
     ObjectCommand   = new RelayCommand <object>((p) => { return(true); }, (p) => { ObjectWindow wd = new ObjectWindow(); wd.ShowDialog(); });
     UserCommand     = new RelayCommand <object>((p) => { return(true); }, (p) => { UserWindow wd = new UserWindow(); wd.ShowDialog(); });
     InputCommand    = new RelayCommand <object>((p) => { return(true); }, (p) => { InputWindow wd = new InputWindow(); wd.ShowDialog(); });
     OutputCommand   = new RelayCommand <object>((p) => { return(true); }, (p) => { OutputWindow wd = new OutputWindow(); wd.ShowDialog(); });
 }
Exemple #10
0
 protected override void UpdateUnitWindow(bool active)
 {
     UnitWindow.update(active && this.ready_for_inputs && (Trading || !Unit_Selected));
 }
        public MainViewModel()
        {
            IsLoadCommand = new RelayCommand <Window>((p) => { return(true); }, (p) =>
            {
                Isload = true;
                p.Hide();
                LoginWindow loginWindow = new LoginWindow();
                loginWindow.ShowDialog();

                /// Khi no dang nhap thanh con moi hien thi main

                if (loginWindow.DataContext == null)
                {
                    return;
                }
                var loginModel = loginWindow.DataContext as LoginViewModel;

                if (loginModel.isLogin)
                {
                    p.Show();
                }
                else
                {
                    p.Close();
                }
            });

            UnitCommand    = new RelayCommand <Window>((p) => true, (p) => { UnitWindow wd = new UnitWindow(); wd.ShowDialog(); });
            SuplierCommand = new RelayCommand <Window>((p) => true, (p) => { SuplierWindow wd = new SuplierWindow(); wd.ShowDialog(); });
            UserCommand    = new RelayCommand <Window>((p) => true, (p) => { UserWindow wd = new UserWindow(); wd.ShowDialog(); });
        }
Exemple #12
0
        public MainWindowViewModel()
        {
            LoadMainWindowCommand = new RelayCommand <Window>(p => { return(p == null ? false : true); }, p =>
            {
                LoadStockInTradeData();
            });

            LoadChildWindowCommand = new RelayCommand <Button>(p => { return(p == null ? false : true); }, p =>
            {
                switch (p.Name)
                {
                case "btnStockin":
                    InputWindow inputWindow  = new InputWindow();
                    FrameworkElement window1 = Window.GetWindow(p);
                    var temp1         = window1 as Window;
                    inputWindow.Owner = temp1;
                    inputWindow.controlBar.packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Import;
                    inputWindow.ShowDialog();
                    break;

                case "btnStockout":
                    OutputWindow outputWindow = new OutputWindow();
                    FrameworkElement window2  = Window.GetWindow(p);
                    var temp2          = window2 as Window;
                    outputWindow.Owner = temp2;
                    outputWindow.controlBar.packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Export;
                    outputWindow.ShowDialog();
                    break;

                case "btnSupplies":
                    SuppliesWindow suppliesWindow = new SuppliesWindow();
                    FrameworkElement window3      = Window.GetWindow(p);
                    var temp3            = window3 as Window;
                    suppliesWindow.Owner = temp3;
                    suppliesWindow.controlBar.packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.PackageVariantClosed;
                    suppliesWindow.ShowDialog();
                    break;

                case "btnUnit":
                    UnitWindow unitWindow    = new UnitWindow();
                    FrameworkElement window4 = Window.GetWindow(p);
                    var temp4        = window4 as Window;
                    unitWindow.Owner = temp4;
                    unitWindow.controlBar.packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.ChartScatterPlotHexbin;
                    unitWindow.ShowDialog();
                    break;

                case "btnSupplier":
                    SupplierWindow supplierWindow = new SupplierWindow();
                    FrameworkElement window5      = Window.GetWindow(p);
                    var temp5            = window5 as Window;
                    supplierWindow.Owner = temp5;
                    supplierWindow.controlBar.packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Factory;
                    supplierWindow.ShowDialog();
                    break;

                case "btnCustomer":
                    CustomerWindow customerWindow = new CustomerWindow();
                    FrameworkElement window6      = Window.GetWindow(p);
                    var temp6            = window6 as Window;
                    customerWindow.Owner = temp6;
                    customerWindow.controlBar.packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.AccountMultiple;
                    customerWindow.ShowDialog();
                    break;

                case "btnUser":
                    UserWindow userWindow    = new UserWindow();
                    FrameworkElement window7 = Window.GetWindow(p);
                    var temp7        = window7 as Window;
                    userWindow.Owner = temp7;
                    userWindow.controlBar.packIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.AccountEdit;
                    userWindow.ShowDialog();
                    break;
                }
            });
        }
Exemple #13
0
 public MainViewModel()
 {
     IsSort = false;
     LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) =>
     {
         if (p == null)
         {
             return;
         }
         p.Hide();
         LoginWindow loginWindow = new LoginWindow();
         loginWindow.ShowDialog();
         if (loginWindow.DataContext == null)
         {
             return;
         }
         var loginVM = loginWindow.DataContext as LoginViewModel;
         if (loginVM.IsLogin)
         {
             p.Show();
             LoadTonKhoData();
             name = loginVM.UserNames;
         }
         else
         {
             p.Close();
         }
     }
                                                     );
     UnitCommand        = new RelayCommand <object>((p) => { return(true); }, (p) => { UnitWindow wd = new UnitWindow(); UnitViewModel vm = new UnitViewModel(); wd.DataContext = vm; wd.ShowDialog(); });
     SuplierCommand     = new RelayCommand <object>((p) => { return(true); }, (p) => { SuplierWindow wd = new SuplierWindow(); SuplierViewModel vm = new SuplierViewModel(); wd.DataContext = vm; wd.ShowDialog(); });
     CustomerCommand    = new RelayCommand <object>((p) => { return(true); }, (p) => { CustomerWindow wd = new CustomerWindow(); CustomerViewModel vm = new CustomerViewModel(); wd.DataContext = vm; wd.ShowDialog(); });
     ObjectCommand      = new RelayCommand <object>((p) => { return(true); }, (p) => { ObjectWindow wd = new ObjectWindow(); ObjectViewModel vm = new ObjectViewModel(); wd.DataContext = vm; wd.ShowDialog(); });
     UserCommand        = new RelayCommand <object>((p) => { return(true); }, (p) => { UserWindow wd = new UserWindow(); UserViewModel vm = new UserViewModel(); wd.DataContext = vm; wd.ShowDialog(); });
     InputCommand       = new RelayCommand <object>((p) => { return(true); }, (p) => { InputWindow wd = new InputWindow(); InputViewModel vm = new InputViewModel(); wd.DataContext = vm; wd.ShowDialog(); });
     OutputCommand      = new RelayCommand <object>((p) => { return(true); }, (p) => { OutputWindow wd = new OutputWindow(); OutputViewModel vm = new OutputViewModel(); wd.DataContext = vm; wd.ShowDialog(); });
     UpdateCommand      = new RelayCommand <object>((p) => { return(true); }, (p) => { LoadTonKhoData(); });
     ExportExcelCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { ExportExcel(); });
     SearchCommand      = new RelayCommand <TextBox>((p) => { return(true); }, (p) => { CollectionViewSource.GetDefaultView(TonKhoList).Refresh(); });
     timkiemCommand     = new RelayCommand <object>((p) => { return(true); }, (p) =>
     {
         CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(TonKhoList);
         view.Filter         = UserFilter;
     });
     #region Sort
     SortDisplaynameCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
     {
         //lấy ra danh sách tồn kho đang hiển thị
         CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(TonKhoList);
         if (IsSort)
         {
             //view.SortDescriptions.Remove(new SortDescription("Object.DisplayName", ListSortDirection.Descending));
             view.SortDescriptions.Clear();                                                                     //xóa sắp xếp cũ để thực hiện lại việc sắp xếp
             view.SortDescriptions.Add(new SortDescription("Object.DisplayName", ListSortDirection.Ascending)); // thực hiện việc sắp xếp tăng dần
         }
         else
         {
             //view.SortDescriptions.Remove(new SortDescription("Object.DisplayName", ListSortDirection.Ascending));
             view.SortDescriptions.Clear();
             view.SortDescriptions.Add(new SortDescription("Object.DisplayName", ListSortDirection.Descending));
         }
         IsSort = !IsSort;
     });
     SortCountCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
     {
         CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(TonKhoList);
         if (IsSort)
         {
             //view.SortDescriptions.Remove(new SortDescription("Count", ListSortDirection.Descending));
             view.SortDescriptions.Clear();
             view.SortDescriptions.Add(new SortDescription("Count", ListSortDirection.Ascending));
         }
         else
         {
             //view.SortDescriptions.Remove(new SortDescription("Count", ListSortDirection.Ascending));
             view.SortDescriptions.Clear();
             view.SortDescriptions.Add(new SortDescription("Count", ListSortDirection.Descending));
         }
         IsSort = !IsSort;
     });
     STTCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
     {
         CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(TonKhoList);
         if (IsSort)
         {
             //view.SortDescriptions.Remove(new SortDescription("Count", ListSortDirection.Descending));
             view.SortDescriptions.Clear();
             view.SortDescriptions.Add(new SortDescription("STT", ListSortDirection.Ascending));
         }
         else
         {
             //view.SortDescriptions.Remove(new SortDescription("Count", ListSortDirection.Ascending));
             view.SortDescriptions.Clear();
             view.SortDescriptions.Add(new SortDescription("STT", ListSortDirection.Descending));
         }
         IsSort = !IsSort;
     });
     #endregion
 }
Exemple #14
0
        void MainView(int windowId)
        {
            mScrollPos = GUI.BeginScrollView(new Rect(0, 0, mMainWindow.width, mMainWindow.height), mScrollPos, new Rect(0, 0, mMainWindow.width, scrollViewHeight));

            float y = 10;

            for (int i = 0; i < mTestRunner.TestUnits.Count; i++)
            {
                var unit = mTestRunner.TestUnits[i];
                if (!unit.isRunning)
                {
                    if (GUI.Button(new Rect(mMainWindow.width - 80, y, 60, 60), "Run", TestViewStyle.BtnStyle))
                    {
                        mTestRunner.StartTestUnit(unit);
                    }

                    if (mUnitWindows != null)
                    {
                        mUnitWindows.Remove(unit);
                    }
                }
                else
                {
                    if (GUI.Button(new Rect(mMainWindow.width - 80, y, 60, 60), "Stop", TestViewStyle.BtnStyle))
                    {
                        mTestRunner.StopTestUnit(unit);
                    }

                    if (unit.runner.HasView)
                    {
                        if (GUI.Button(new Rect(mMainWindow.width - 80, y + 60, 60, 60), "View", TestViewStyle.BtnStyle))
                        {
                            if (mUnitWindows == null)
                            {
                                mUnitWindows = new Dictionary <TestRunner.UnitState, UnitWindow>();
                            }
                            UnitWindow window;
                            if (!mUnitWindows.TryGetValue(unit, out window))
                            {
                                window             = new UnitWindow(WINDOW_ID + i + 1, unit.runner.ViewRect);
                                mUnitWindows[unit] = window;
                            }
                            window.isShow = !window.isShow;
                        }
                    }
                }

                StringBuilder sb = new StringBuilder();
                sb.Append(unit.unitType.ToString().ColorFormat(Color.green));
                var info = unit.unitType.GetCustomAttributes(typeof(TestUnitInfoAttribute), false);
                if (info.Length > 0)
                {
                    sb.Append("\n").Append(((TestUnitInfoAttribute)info[0]).DisplayName.ColorFormat(Color.green));
                    //sb.Append(": ").Append(((TestUnitInfoAttribute)info[0]).Description.ColorFormat(Color.green));
                }
                foreach (MethodInfo unitCase in unit.unitCases.Keys)
                {
                    sb.Append("\n  ");
                    switch (unit.unitCases[unitCase].result)
                    {
                    case TestRunner.CaseState.Result.Idle:
                        sb.Append(("+++" + unitCase.Name).ColorFormat("#6AFF00FF"));
                        break;

                    case TestRunner.CaseState.Result.Run:
                        sb.Append((">>>" + unitCase.Name).ColorFormat(Color.cyan));
                        break;

                    case TestRunner.CaseState.Result.Success:
                        sb.Append(("###" + unitCase.Name).ColorFormat(Color.yellow));
                        break;

                    case TestRunner.CaseState.Result.Fail:
                        sb.Append(("###" + unitCase.Name).ColorFormat(Color.red));
                        break;
                    }
                }
                sb.Append("\n------".ColorFormat(Color.blue));
                if (unit.Failed)
                {
                    sb.Append("Failed".ColorFormat(Color.red));
                }
                else if (unit.Successed)
                {
                    sb.Append("Success".ColorFormat(Color.yellow));
                }

                GUIContent unitContent = new GUIContent(sb.ToString());
                float      width       = mMainWindow.width - 90;
                float      height      = TestViewStyle.LabelStyle.CalcHeight(unitContent, width);
                GUI.Label(new Rect(10, y, width, height), unitContent, TestViewStyle.LabelStyle);

                y += height + 5;
            }

            GUI.EndScrollView();
        }
 // mọi thứ xử lý sẽ nằm trong này
 public MainViewModel()
 {
     if (!IsLoaded)
     {
         LoadedWindowCommand = new RelayCommand <Window>((p) => { return(true); }, (p) =>
         {
             IsLoaded = true;
             if (p == null)
             {
                 return;
             }
             p.Hide();
             LoginWindow login = new LoginWindow();
             login.ShowDialog();
             if (login.DataContext == null)
             {
                 return;
             }
             var LoginVM = login.DataContext as LoginViewModel;
             if (LoginVM.IsLogin)
             {
                 p.Show();
                 LoadTonKhoData();
             }
             else
             {
                 p.Close();
             }
         });
         UnitCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
         {
             UnitWindow unit = new UnitWindow();
             unit.ShowDialog();
         });
         SuplierCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
         {
             SuplierWindow suplier = new SuplierWindow();
             suplier.ShowDialog();
         });
         CustomerCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
         {
             CustomerWindow suplier = new CustomerWindow();
             suplier.ShowDialog();
         });
         ObjectCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
         {
             ObjectWindow suplier = new ObjectWindow();
             suplier.ShowDialog();
         });
         UserCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
         {
             UserWindow suplier = new UserWindow();
             suplier.ShowDialog();
         });
         InputCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
         {
             InputWindow suplier = new InputWindow();
             suplier.ShowDialog();
         });
         OutnputCommand = new RelayCommand <object>((p) => { return(true); }, (p) =>
         {
             OutputWindow suplier = new OutputWindow();
             suplier.ShowDialog();
         });
     }
 }
        public MainViewModel()
        {
            ImportWindow = new RelayCommand <Window>((p) => { return(true); }, (p) =>
            {
                if (_UserIDRole != 1)
                {
                    LoadDialogErrorNotPermission();
                    return;
                }
                ImportWindow wd = new ImportWindow();
                wd.ShowDialog();
            });
            SellWindow     = new RelayCommand <Window>((p) => { return(true); }, (p) => { SellWindow wd = new SellWindow(); wd.ShowDialog(); });
            CustomerWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                          {
                                                                                              LoadDialogErrorNotPermission(); return;
                                                                                          }
                                                                                          CustomerWindow wd = new CustomerWindow(); wd.ShowDialog(); });
            ProductWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                         {
                                                                                             LoadDialogErrorNotPermission(); return;
                                                                                         }
                                                                                         ProductWindow wd = new ProductWindow(); wd.ShowDialog(); });
            SupplierWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                          {
                                                                                              LoadDialogErrorNotPermission(); return;
                                                                                          }
                                                                                          SupplierWindow wd = new SupplierWindow(); wd.ShowDialog(); });
            StatisticalWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                             {
                                                                                                 LoadDialogErrorNotPermission(); return;
                                                                                             }
                                                                                             StatisticalWindow wd = new StatisticalWindow(); wd.ShowDialog(); });
            UnitWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                      {
                                                                                          LoadDialogErrorNotPermission(); return;
                                                                                      }
                                                                                      UnitWindow wd = new UnitWindow(); wd.ShowDialog(); });
            UserListWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                          {
                                                                                              LoadDialogErrorNotPermission(); return;
                                                                                          }
                                                                                          UserListWindow wd = new UserListWindow(); wd.ShowDialog(); });
            AccountCreateWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                               {
                                                                                                   LoadDialogErrorNotPermission(); return;
                                                                                               }
                                                                                               AccountCreateWindow wd = new AccountCreateWindow(); wd.ShowDialog(); });
            BillWindow = new RelayCommand <Window>((p) => { return(true); }, (p) => { if (_UserIDRole != 1)
                                                                                      {
                                                                                          LoadDialogErrorNotPermission(); return;
                                                                                      }
                                                                                      BillWindow wd = new BillWindow(); wd.ShowDialog(); });
            LoadMainWindow = new RelayCommand <Window>((p) => { return(true); }, (p) =>
            {
                if (!isLoaded)
                {
                    isLoaded = true;
                    if (p == null)
                    {
                        return;
                    }

                    p.Hide();
                    LoginWindow wd = new LoginWindow();
                    wd.ShowDialog();
                    var loginViewModel = wd.DataContext as LoginViewModel;
                    if (loginViewModel == null)
                    {
                        return;
                    }
                    if (loginViewModel.isLogin)
                    {
                        loadUserCurrentLogin();
                        p.Show();
                    }
                    else
                    {
                        p.Close();
                    }
                }
            });

            LoadEditCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { LoadDialogAccountEdit(); });
        }
        public MainViewModel()
        {
            LoadedWindowCommand = new RelayCommand <Window>(p => { return(true); }, p =>
            {
                if (p == null)
                {
                    return;
                }
                p.Hide();
                LoginWindow loginWindow = new LoginWindow();
                loginWindow.ShowDialog();

                if (loginWindow.DataContext == null)
                {
                    return;
                }
                var loginVM = loginWindow.DataContext as LoginViewModel;
                if (loginVM.isLogin)
                {
                    p.Show();
                }
                else
                {
                    p.Close();
                }
            });

            UnitCommand = new RelayCommand <object>(p => { return(true); }, p =>
            {
                UnitWindow wd = new UnitWindow();
                wd.ShowDialog();
            });

            SuplierCommand = new RelayCommand <object>(p => { return(true); }, p =>
            {
                SuplierWindow wd = new SuplierWindow();
                wd.ShowDialog();
            });

            CustomerCommand = new RelayCommand <object>(p => { return(true); }, p =>
            {
                CustomerWindow wd = new CustomerWindow();
                wd.ShowDialog();
            });

            ObjectCommand = new RelayCommand <object>(p => { return(true); }, p =>
            {
                ObjectWindow wd = new ObjectWindow();
                wd.ShowDialog();
            });

            UserCommand = new RelayCommand <object>(p => { return(true); }, p =>
            {
                UserWindow wd = new UserWindow();
                wd.ShowDialog();
            });

            InputCommand = new RelayCommand <object>(p => { return(true); }, p =>
            {
                InputWindow wd = new InputWindow();
                wd.ShowDialog();
            });

            OutputCommand = new RelayCommand <object>(p => { return(true); }, p =>
            {
                OutputWindow wd = new OutputWindow();
                wd.ShowDialog();
            });
        }
Exemple #18
0
 protected override void UpdateUnitWindow(bool active)
 {
     UnitWindow.update(active && this.ready_for_inputs);
 }