protected override bool Execute(CodeActivityContext context)
        {
            bool success = false;

            success = DispatcherControl.PushCommand(EngineControl.Shutdown);

            return(success);
        }
Exemplo n.º 2
0
        private void OnEnterLogin(object parametr)
        {
            int count = 0;

            foreach (var item in Users)
            {
                if (item.UserLogin.Equals(_login) && item.Password.Equals(_password))
                {
                    if (item.UserLogin.Equals("Admin"))
                    {
                        var windowAdmin = WindowFactory.CreateWindow(new WindowCreationOptions()
                        {
                            WindowSize    = new WindowSize(new Size(800, 450)),
                            Title         = "Admin menu",
                            Tag           = "AdminWindow",
                            SizeToContent = SizeToContent.Height
                        });

                        var adminControl = new AdminControl();
                        windowAdmin.Content = adminControl;
                        Application.Current.MainWindow.Hide();
                        var resultAdmin = windowAdmin.ShowDialog();
                        Application.Current.MainWindow.Show();

                        if (!resultAdmin != true)
                        {
                            return;
                        }
                        break;
                    }
                    else
                    {
                        var windowDispatcher = WindowFactory.CreateWindow(new WindowCreationOptions()
                        {
                            WindowSize    = new WindowSize(new Size(800, 450)),
                            Title         = "Dispatcher menu",
                            Tag           = "DispatcherWindow",
                            SizeToContent = SizeToContent.Height,
                        });

                        var dispatcharControl = new DispatcherControl();
                        windowDispatcher.Content = dispatcharControl;

                        Application.Current.MainWindow.Hide();
                        var resultDispatcher = windowDispatcher.ShowDialog();
                        Application.Current.MainWindow.Show();

                        if (!resultDispatcher != true)
                        {
                            return;
                        }
                        break;
                    }
                }
                else
                {
                    count++;
                }
                if (Users.Count == count)
                {
                    IsConnectedAdmin      = false;
                    IsConnectedDispatcher = false;
                    MessageBox.Show("Не верно введены данные!!!");
                }
            }



            //var login = Users.Select(x => new { Login = x.UserLogin, Password = x.Password }).Where(x => x.Login.Equals(Login) && x.Password.Equals(Password));//.Where(x=> x.Equals(Password));
            //if (login.Count() != 0)
            //{

            //}
        }