public AppClientModel(Window window) : base(window)
 {
     CloseAppClientWindowCommand = new RelayCommand2(() => TaskManager.ViewModel.ProcessAppActive = false);
     DeleteProcess   = new RelayCommand2(async() => await DeleteAsync());
     SentGoogleDrive = new RelayCommand2(async() => { await SenterGoogleDrive.SentDriveAsync(ModelLogin.service, TaskManager.ViewModel.ProcessFromClient, "Process Info-"); });
     Task.Run(async() => await Refresh());
 }
        public void InitializeViewModel()
        {
            var removeAllFromCartCommand
                = new RemoveAllFromCartCommand(shoppingCartRepository, productRepository);

            RemoveAllFromCartCommand = new RelayCommand2(
                execute: () =>
            {
                removeAllFromCartCommand.Execute();

                Refresh();
            },
                canExecute: () => removeAllFromCartCommand.CanExecute()
                );

            CheckoutCommand = new RelayCommand2(
                execute: () => {
                var total = LineItems.Sum(x => x.Product.Price * x.Quantity);
                MessageBox.Show($"Shopping cart total: ${total}");
            },
                canExecute: () => LineItems.Any()
                );

            Refresh();
        }
Beispiel #3
0
 public AudioModel(Window window) : base(window)
 {
     CloseAudioWindowCommand = new RelayCommand2(() => {; TaskManager.ViewModel.AudioRecorderActive = false; });
     WriteAudio      = new RelayCommand2(() => { SendSignalToWriteAudio(); });
     PlayAudio       = new RelayCommand2(() => { PlayMessage(); });
     SentGoogleDrive = new RelayCommand2(async() => { await SenterGoogleDrive.SentDriveAsync(ModelLogin.service, TaskManager.ViewModel.Audio, "Audio"); });
 }
Beispiel #4
0
        public ComputerInfoModel(Window window) : base(window)
        {
            var el = Encoding.ASCII.GetString(TaskManager.ViewModel.ComputerInfo).Split(',').AsParallel();

            el.ForEachAsync(el.Count(), async i => await Info.AddAsync(new StringValue(i)));
            CloseInfoWindowCommand = new RelayCommand2(() => { TaskManager.ViewModel.InfoComp = false; });
            SentGoogleDrive        = new RelayCommand2(async() => { await SaveDBAsync(); });
        }
Beispiel #5
0
        public ProductViewModel(ShoppingCartViewModel shoppingCartViewModel,
                                IShoppingCartRepository shoppingCartRepository,
                                IProductRepository productRepository,
                                Product product,
                                int quantity = 0)
        {
            Product  = product;
            Quantity = quantity;

            var addToCartCommand =
                new AddToCartCommand(shoppingCartRepository, productRepository, product);

            var increaseQuantityCommand =
                new ChangeQuantityCommand(ChangeQuantityCommand.Operation.Increase,
                                          shoppingCartRepository,
                                          productRepository,
                                          product);

            var decreaseQuantityCommand =
                new ChangeQuantityCommand(ChangeQuantityCommand.Operation.Decrease,
                                          shoppingCartRepository,
                                          productRepository,
                                          product);

            var removeFromCartCommand =
                new RemoveFromCartCommand(shoppingCartRepository,
                                          productRepository,
                                          product);

            AddToCartCommand = new RelayCommand2(
                execute: () => {
                addToCartCommand.Execute();
                shoppingCartViewModel.Refresh();
            },
                canExecute: () => addToCartCommand.CanExecute());

            IncreaseQuantityCommand = new RelayCommand2(
                execute: () => {
                increaseQuantityCommand.Execute();
                shoppingCartViewModel.Refresh();
            },
                canExecute: () => increaseQuantityCommand.CanExecute());

            DecreaseQuantityCommand = new RelayCommand2(
                execute: () => {
                decreaseQuantityCommand.Execute();
                shoppingCartViewModel.Refresh();
            },
                canExecute: () => decreaseQuantityCommand.CanExecute());

            RemoveFromCartCommand = new RelayCommand2(
                execute: () => {
                removeFromCartCommand.Execute();
                shoppingCartViewModel.Refresh();
            },
                canExecute: () => removeFromCartCommand.CanExecute());
        }
        public LoggInViewModel(IPasswordVerfierServices passwordVerifierServices, ILoggInRepository loggInRepository, IUserRepository userRepository)
        {
            #region Properties Initialization

            _loggInRepository          = loggInRepository;
            _passwordVerfifierServices = passwordVerifierServices;
            _loggInGoodViewModel       = new LoggInGoodViewModel();
            _userRepository            = userRepository;
            #endregion

            #region RelayCommands
            SuccesfullLoggInCommand = new RelayCommand2(LogInSecure);
            _viewUsers = new RelayCommand(ViewUsersList);
            #endregion
        }
 public RemoteDekstopModel(Window window) : base(window)
 {
     Cursor = Cursors.Wait;
     CloseRemoteWindowCommand = new RelayCommand2(() => StopRD());
     MouseDoubleClickImage    = new RelayCommand2(() => {
         if (Cursor == Cursors.Hand)
         {
             Serverr.MainServer.Send(TaskManager.ViewModel.selectedData.Id, Encoding.ASCII.GetBytes(@"[<MOUSE>]DOUBLE[<\MOUSE>][<X>]" + MouseX + @"[<\X>][<Y>]" + MouseY + @"[<\Y>]"));
         }
     });
     MouseClickLeftImage = new RelayCommand2(() =>
     {
         if (Cursor == Cursors.Hand)
         {
             Serverr.MainServer.Send(TaskManager.ViewModel.selectedData.Id, Encoding.ASCII.GetBytes(@"[<MOUSE>]SINGLE-LEFT[<\MOUSE>][<X>]" + MouseX + @"[<\X>][<Y>]" + MouseY + @"[<\Y>]"));
         }
     });
     MouseClickRightImage = new RelayCommand2(() =>
     {
         if (Cursor == Cursors.Hand)
         {
             Serverr.MainServer.Send(TaskManager.ViewModel.selectedData.Id, Encoding.ASCII.GetBytes(@"[<MOUSE>]SINGLE-RIGHT[<\MOUSE>][<X>]" + MouseX + @"[<\X>][<Y>]" + MouseY + @"[<\Y>]"));
         }
     });
     DownButton = new RelayCommand2(() =>
     {
         if (Cursor == Cursors.Hand)
         {
             Cursor = Cursors.Wait;
         }
         else
         {
             Cursor = Cursors.Hand;
         }
     });
     Task.Factory.StartNew(() =>
     {
         Action action = delegate
         {
             GetScreenAsync();
         };
         while (true)
         {
             Task.Delay(10);
             System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, action);
         }
     });
 }
Beispiel #8
0
        public MainViewModel()
        {
            QuitterCommand = new RelayCommand2(() =>
            {
                Application.Current.MainWindow.Close();
            });

            ToggleCommand = new RelayCommand2(() =>
            {
                Application.Current.MainWindow.WindowState = Application.Current.MainWindow.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
            });

            MinimizeCommand = new RelayCommand2(() =>
            {
                Application.Current.MainWindow.WindowState = WindowState.Minimized;
            });
        }
 public ChatWindowModel(Window window) : base(window)
 {
     Serverr.MainServer.Send(TaskManager.ViewModel.selectedData.Id, Encoding.ASCII.GetBytes("[<MESSAGE>]Opened chat"));
     CloseChatWindowCommand = new RelayCommand2(async() => { await Task.Run(() => Serverr.MainServer.Send(TaskManager.ViewModel.selectedData.Id, Encoding.ASCII.GetBytes("CloseChat"))); TaskManager.ViewModel.ChatActive = false; });
     SendMessage            = new RelayCommand2(async() => { await SentAsync(); });
 }
Beispiel #10
0
 public ChangeNameViewModel()
 {
     ChangeMessageCommand = new RelayCommand2 <string> (param => Message = param);
 }