Exemplo n.º 1
0
        /// <summary>
        /// Initializes the main window.
        /// </summary>
        private void InitializeMainWindow()
        {
            Loaded         += MainWindow_Loaded;
            UrlTextBox.Text = @"http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8";

            var args = Environment.GetCommandLineArgs();

            if (args != null && args.Length > 1)
            {
                UrlTextBox.Text = args[1].Trim();
                OpenCommand.Execute();
            }

            OpenMediaPopup.Opened += (s, e) =>
            {
                UrlTextBox.SelectAll();
                UrlTextBox.Focus();
            };

            UrlTextBox.KeyDown += (s, e) =>
            {
                if (e.Key == Key.Enter)
                {
                    OpenCommand.Execute();
                    e.Handled = true;
                }
            };
        }
Exemplo n.º 2
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public MainWindowViewModel()
 {
     server = new Server(false, false, SendData);
     _      = ClosedCommand.Subscribe(Close).AddTo(Disposable);
     _      = OpenCommand.Subscribe(tcpOpne).AddTo(Disposable);
     _      = CloseCommand.Subscribe(tcpClose).AddTo(Disposable);
 }
Exemplo n.º 3
0
        private void InitializeComponents()
        {
            Images = new List <RemoteImage>();

            InsertRemotePicture = new InsertRemotePictureCommand(CurrentWindow, Images);
            InsertQuote         = new InsertQuoteCommand(CurrentWindow);
            InsertCheckList     = new InsertCheckListCommand();
            ImportMarkDown      = new InportMarkDownCommand();
            ExportToMarkDown    = new ExportToMarkDownCommand();
            OpenOptions         = new OpenOptionsCommand(CurrentWindow);
            ToggleTheme         = new ToggleThemeCommand(CurrentWindow);
            ToggleFullScreen    = new ToggleFullScreenCommand(CurrentWindow);

            OpenCommand = new OpenCommand(CurrentWindow);
            Open        = new OpenDocumentCommand(OpenCommand);
            SaveCommand = new SaveCommand(CurrentWindow);
            Save        = new SaveDocumentCommand(SaveCommand);

            MainMenu = new List <MenuItem>
            {
                new NewCommand(CurrentWindow.TextEditor),
                OpenCommand,
                SaveCommand,
                new EmptyCommand(),
                new PrintCommand(CurrentWindow.TextEditor),
                new EmptyCommand(),
                new ShortcutsCommand(CurrentWindow),
                new AboutCommand(CurrentWindow),
                new ExitCommand(CurrentWindow)
            };

            PinIcon = ConfigurationHandler.Current.IsToolbarFixed ?
                      PackIconModernKind.ArrowUp :
                      PackIconModernKind.ArrowDown;
        }
Exemplo n.º 4
0
        /// <summary>
        /// コンストラクター
        /// </summary>
        public MainWindowViewModel(IAppSettingsService appSettingsService, IOpenFileDialogService openFileDialogService, ITextReadService textReadService, ITalkService talkService, ITalkQueueService talkQueueService)
        {
            AppSettingsService    = appSettingsService;
            OpenFileDialogService = openFileDialogService;
            TextReadService       = textReadService;
            TalkService           = talkService;
            TalkQueueService      = talkQueueService;

            TextReadService.Subscribe(TalkQueueService.Enqueue);

            SelectedCast.Value = TalkService.Cast;
            SelectedCast.Subscribe(x => TalkService.Cast = x);

            Volume.Value = TalkService.Volume;
            Volume.Subscribe(x => TalkService.Volume = x);

            Speed.Value = TalkService.Speed;
            Speed.Subscribe(x => TalkService.Speed = x);

            Tone.Value = TalkService.Tone;
            Tone.Subscribe(x => TalkService.Tone = x);

            Alpha.Value = TalkService.Alpha;
            Alpha.Subscribe(x => TalkService.Alpha = x);

            ToneScale.Value = TalkService.ToneScale;
            ToneScale.Subscribe(x => TalkService.ToneScale = x);

            LoadSettingsCommand.Subscribe(LoadSettings);
            SaveSettingsCommand.Subscribe(SaveSettings);

            OpenCommand.Subscribe(Open);

            ToggleWatchCommand.Subscribe(ToggleWatch);
        }
Exemplo n.º 5
0
        public MainPageViewModel(INavigationService navigationService)
            : base(navigationService)
        {
            //ViweModel→Model
            this.ServerSwitch = ReactiveProperty.FromObject(socket, x => x.IsServer).AddTo(this.Disposable);
            this.IpAddress    = ReactiveProperty.FromObject(socket, x => x.IpAddress).AddTo(this.Disposable);
            this.Port         = ReactiveProperty.FromObject(socket, x => x.Port).AddTo(this.Disposable);
            //ViewModel←Model
            this.SettingIsEnabled = socket.ObserveProperty(x => x.IsOpen).Select(x => !x).ToReactiveProperty().AddTo(this.Disposable);
            this.CloseCommand     = socket.ObserveProperty(x => x.IsOpen).ToReactiveCommand().AddTo(this.Disposable);
            this.OpenCommand      = socket.ObserveProperty(x => x.IsOpen).Select(x => !x).ToReactiveCommand().AddTo(this.Disposable);
            this.SendCommand      = socket.ObserveProperty(x => x.IsOpen).ToReactiveCommand().AddTo(this.Disposable);
            this.ActionView       = socket.ActionInfo.ToReadOnlyReactiveCollection().AddTo(this.Disposable);
            //ViewModel=Model
            this.SendData = socket.ToReactivePropertyAsSynchronized(x => x.SendData).AddTo(this.Disposable);

            //ViweModel内
            this.ServerSwitchInfo          = this.ServerSwitch.Select(x => x ? "サーバー" : "クライアント").ToReactiveProperty().AddTo(this.Disposable);
            this.IPAddressSettingIsEnabled = this.SettingIsEnabled.CombineLatest(this.ServerSwitch, (x, y) => x && !y) //クライアント且つCLOSE時のみIPアドレスは入力編集が可能
                                             .ToReactiveProperty().AddTo(this.Disposable);

            //ボタン
            OpenCommand.Subscribe(_ => socket.Open());
            CloseCommand.Subscribe(_ => socket.Close());
            SendCommand.Subscribe(_ => socket.Send());
        }
 private void InitCommands()
 {
     OpenCommand              = new OpenCommand(this);
     ApplyCommand             = new ApplyCommand(this);
     FlipCommand              = new FlipCommand(this);
     HistogramEqualizeCommand = new HistogramEqualizeCommand(this);
     HistogramStretchCommand  = new HistogramStretchCommand(this);
     CropCommand              = new CropCommand(this);
     InpaintCommand           = new InpaintCommand(this);
     ResizeCommand            = new ResizeCommand(this);
     RotateCommand            = new RotateCommand(this);
     SaveAsCommand            = new SaveAsCommand(this);
     SaveCommand              = new SaveCommand(this);
     ZoomCommand              = new ZoomCommand(this);
     ResetCommand             = new ResetCommand(this);
     CloseCommand             = new CloseCommand(this);
     SelectToolCommand        = new SelectToolCommand(this);
     UndoCommand              = new UndoCommand(this);
     RedoCommand              = new RedoCommand(this);
     DropboxCommand           = new DropboxCommand(this);
     DownloadCommand          = new DownloadCommand(this);
     UploadCommand            = new UploadCommand(this);
     DCommand       = new DCommand(this);
     ECommand       = new ECommand(this);
     PrewittCommand = new PrewittCommand(this);
 }
Exemplo n.º 7
0
 void HandleLoadedProjectChanged(object sender, PropertyChangedEventArgs e)
 {
     ExportCommand?.EmitCanExecuteChanged();
     SaveCommand?.EmitCanExecuteChanged();
     OpenCommand?.EmitCanExecuteChanged();
     DeleteCommand?.EmitCanExecuteChanged();
 }
Exemplo n.º 8
0
        public AppContext()
        {
            NavigateCommand = new NavigateCommand(this);
            OpenCommand     = new OpenCommand(this);
            RefreshCommand  = new RefreshCommand(this);

            Drives = DriveInfo.GetDrives()
                     .Where(d => d.DriveType == DriveType.Fixed && d.IsReady)
                     .Select(d => new Drive(d)).ToList();
        }
Exemplo n.º 9
0
        public ClassViewModel()
        {
            Properties = new List<string>();
            var max = rnd.Next(10);
            for (int i = 0; i < max; i++)
            {
                Properties.Add("Property " + (i + 1));
            }

            Open = new OpenCommand();
        }
Exemplo n.º 10
0
        public RepoViewModel(USCurrencyRepo repo)
        {
            this.repository  = repo;
            addCoinCommand   = new AddCoinCommand(AddCoins);
            coinsForComboBox = new ObservableCollection <ICoin>(USCurrencyRepo.GetCoinList());
            CoinName         = coinsForComboBox.First().ToString();

            newCommand  = new NewCommand(NewRepo);
            openCommand = new OpenCommand(OpenRepo);
            saveCommand = new SaveCommand(SaveRepo);
        }
Exemplo n.º 11
0
        protected override void OnOpened(EventArgs e)
        {
            base.OnOpened(e);

            // Open file dialog directly after app start
            if (Application.Current is App app && app.Host is not null)
            {
                var vm = app.Host.Services.GetService <ActionsPanelViewModel>();
                vm !.OpenCommand.Execute().Subscribe();
            }
        }
Exemplo n.º 12
0
 public MainViewModel()
 {
     DatagridPreviewCommand           = new DatagridPreviewCommand(this);
     PartitionsDatagridPreviewCommand = new PartitionsDatagridPreviewCommand(this);
     OpenCommand           = new OpenCommand(this);
     ExportCommand         = new ExportCommand(this);
     OpenHelpCommand       = new OpenHelpCommand();
     OpenAboutCommand      = new OpenAboutCommand();
     CloseWindowCommand    = new CloseWindowCommand();
     PartitionsViewCommand = new PartitionsViewCommand(this);
 }
Exemplo n.º 13
0
        public void Work()
        {
            IReceiver receiver = new Receiver();

            ICommand openCommand  = new OpenCommand(receiver);
            ICommand closeCommand = new CloseCommand(receiver);
            IInvoker invoker      = new Invoker(openCommand, closeCommand);

            invoker.WriteInFile("Blya blya blya");
            invoker.WriteInFile("Wurp wurp wurp");
        }
Exemplo n.º 14
0
        public LegoViewModel()
        {
            Debug.Write("public LegoViewModel()");
            _StartCollectingCommand = new StartCollectingCommand();
            _StopCollectingCommand  = new StopCollectingCommand();
            _OpenCommand            = new OpenCommand(this);
            _CloseCommand           = new CloseCommand(this);
            _DeleteCommand          = new DeleteCommand(this);

            LgPersistor.Init();
            LgPersistor.GetAllConfigs().ForEach((c) => _Configs.Add(c));
        }
Exemplo n.º 15
0
        protected TransportViewModel(DataTransport <T> dataTransport)
        {
            _dataTransport = dataTransport;
            _dataTransport.CanOpenChanged  += delegate { OpenCommand.RaiseCanExecuteChanged(); };
            _dataTransport.CanCloseChanged += delegate { CloseCommand.RaiseCanExecuteChanged(); };


            _dataTransport.IsOpenChanged += (sender, args) =>
            {
                RaisePropertyChanged(nameof(IsOpen));
            };
        }
Exemplo n.º 16
0
 public MainViewModel() : base()
 {
     AjouterJ = new AjouterJeu();
     Pers     = new Personne();
     // Connexion = new BaseCommand(Conn, obj => true);
     Inscription     = new BaseCommand(Ins, obj => true);
     Ajouter         = new BaseCommand(Ajout, obj => true);
     OpenInscription = new OpenCommand(this);
     OpenConnexion   = new OpenConnexion(this);
     SeConnecter     = new Connexion(this);
     AjoutJeux       = new AjouterJeux(this);
 }
        public ReferencesViewModel(CheckCommand checkCommand, OpenCommand openCommand)
        {
            filter = new FilterModel();

            resultViewModels = new IReferencesDetailsViewModel[]
            {
                new ReferencesTreeViewModel(filter, checkCommand, openCommand),
                new ReferencesGridViewModel(filter, checkCommand, openCommand)
            };

            SelectedResultViewModels = resultViewModels[0];
        }
Exemplo n.º 18
0
        public ClassViewModel()
        {
            Properties = new List <string>();
            var max = rnd.Next(10);

            for (int i = 0; i < max; i++)
            {
                Properties.Add("Property " + (i + 1));
            }

            Open = new OpenCommand();
        }
        public ReferencesTreeViewModel(FilterModel filter, CheckCommand checkCommand, OpenCommand openCommand)
        {
            this.checkCommand = checkCommand;
            this.openCommand  = openCommand;

            OpenSubResultCommand       = new Command <AssemblyTreeModel>(x => this.openCommand.OpenSubAssembly(x.Reference.LoadedAssembly));
            OpenParentReferenceCommand = new Command <AssemblyTreeModel>(async(x) => await this.openCommand.ViewParentReferenceAsync(assembly, x.Reference).ConfigureAwait(false));

            CircularDependenciesCheckCommand = new Command <AssemblyTreeModel>(async(x) => await this.checkCommand.CircularDependenciesCheck(x.Reference.LoadedAssembly).ConfigureAwait(false));
            MissingentryPointCheckCommand    = new Command <AssemblyTreeModel>(async(x) => await this.checkCommand.EntryPointNotFoundCheck(x.Reference.LoadedAssembly).ConfigureAwait(false));
            Filter = filter;
        }
Exemplo n.º 20
0
 protected override void RaiseCanExecuteCommands()
 {
     OpenCommand.RaiseCanExecuteChanged();
     CloseCommand.RaiseCanExecuteChanged();
     //NextPageCommand.RaiseCanExecuteChanged();
     //PreviousPageCommand.RaiseCanExecuteChanged();
     //FirstPageCommand.RaiseCanExecuteChanged();
     //LastPageCommand.RaiseCanExecuteChanged();
     SaveCommand.RaiseCanExecuteChanged();
     NewCommand.RaiseCanExecuteChanged();
     DeleteCommand.RaiseCanExecuteChanged();
     ReloadCommand.RaiseCanExecuteChanged();
 }
Exemplo n.º 21
0
        public void RunCommandTest()
        {
            var openCommand    = new OpenCommand();
            var closeCommand   = new CloseCommand();
            var changeCommand  = new ChangeCommand();
            var commandInvoker = new CommandInvoker();

            commandInvoker.AddCommand(openCommand);
            commandInvoker.AddCommand(closeCommand);

            commandInvoker.RunCommand();

            Assert.True(commandInvoker.Records[0] == "Open" &&
                        commandInvoker.Records[1] == "Close");
        }
Exemplo n.º 22
0
        public void OpenCommandTest()
        {
            StartGameCommandTest();

            int robotBattery = _context.Robot.BatteryBalance;
            int mass         = _context.Robot.Mass;

            ICommand openCommand = new OpenCommand(_context);

            openCommand.Execute();

            Assert.IsFalse(robotBattery == _context.Robot.BatteryBalance);
            Assert.IsFalse(mass == _context.Robot.Mass);
            Assert.IsTrue(_context.State is DecidingState);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Обрабатывает нажатие клавиши.
        /// </summary>
        /// <param name="sender">Объект-отправитель.</param>
        /// <param name="e">Передаваемые данные.</param>
        public void OnPageKeyDown(object sender, KeyRoutedEventArgs e)
        {
            if (e.Key == VirtualKey.Control)
            {
                _isCtrlKeyPressed = true;
            }

            if (_isCtrlKeyPressed)
            {
                switch (e.Key)
                {
                case VirtualKey.O: OpenCommand.Execute(null); break;

                case VirtualKey.P: PrintCommand.Execute(null); break;
                }
            }
        }
Exemplo n.º 24
0
 public FileCommand(NewCommand newCommand, OpenCommand openCommand, SaveCommand saveCommand, SaveAsCommand saveAsCommand,
                    PrintCommand printCommand, PrintPreviewCommand printPreviewCommand, ExitCommand exitCommand) : base(MenuStrings.fileToolStripMenuItem_Text)
 {
     ChildrenCommands = new List <IToolbarCommand>
     {
         newCommand,
         openCommand,
         null,
         saveCommand,
         saveAsCommand,
         null,
         printCommand,
         printPreviewCommand,
         null,
         exitCommand
     };
 }
Exemplo n.º 25
0
        private void Open()
        {
            var dialog = new OpenFileDialog
            {
                CheckFileExists  = true,
                DefaultExt       = "json",
                Multiselect      = false,
                RestoreDirectory = true,
                Filter           = @"JSON files (*.json)|*.json|All files (*.*)|*.*"
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                OpenCommand command = new OpenCommand(TargetDrawing, dialog.FileName);
                command.TargetDrawing = TargetDrawing;
                _invoker.EnqueueCommandForExecution(command);
            }
        }
Exemplo n.º 26
0
        public void Test_Document()
        {
            DocumentReceiver receiver = new DocumentReceiver();

            ICommandDocument openCommand  = new OpenCommand(receiver);
            ICommandDocument closeCommand = new CloseCommand(receiver);
            ICommandDocument saveCommand  = new SaveCommand(receiver);

            MenuOption menu = new MenuOption
                              (
                openCommand: openCommand,
                saveCommand: saveCommand,
                closeCommand: closeCommand
                              );

            menu.OpenClick();
            menu.SaveClick();
            menu.CloseClick();
        }
Exemplo n.º 27
0
        private void OnInitWorkArea()
        {
            _isWorkAreaIniting = true;

            NewCommand.RaiseCanExecuteChanged();
            OpenCommand.RaiseCanExecuteChanged();
            SaveAllCommand.RaiseCanExecuteChanged();

            //Work Area
            var selectedTab = XamlTabs.FirstOrDefault(tab => tab.IsSelected);

            selectedTab?.InitWorkArea();

            _isWorkAreaIniting = false;

            NewCommand.RaiseCanExecuteChanged();
            OpenCommand.RaiseCanExecuteChanged();
            SaveAllCommand.RaiseCanExecuteChanged();
        }
        /// <summary>
        /// Initializes the main window.
        /// </summary>
        private void InitializeMainWindow()
        {
            Loaded         += MainWindow_Loaded;
            UrlTextBox.Text = HistoryItems.Count > 0 ? HistoryItems.First() : string.Empty;

            // If you don't want to show the first frame upon loading.
            // Media.ScrubbingEnabled = false;
            // Media.LoadedBehavior = MediaState.Pause;

            // Open a file if it is specified in the arguments
            var args = Environment.GetCommandLineArgs();

            if (args != null && args.Length > 1)
            {
                UrlTextBox.Text = args[1].Trim();
                OpenCommand.Execute();
            }

            OpenMediaPopup.Opened += (s, e) =>
            {
                if (UrlTextBox.ItemsSource == null)
                {
                    UrlTextBox.ItemsSource = HistoryItems;
                }

                if (HistoryItems.Count > 0)
                {
                    UrlTextBox.Text = HistoryItems.First();
                }

                UrlTextBox.Focus();
            };

            UrlTextBox.KeyDown += (s, e) =>
            {
                if (e.Key == Key.Enter)
                {
                    OpenCommand.Execute();
                    e.Handled = true;
                }
            };
        }
Exemplo n.º 29
0
        public async Task SendCommand(string valveId, string command)
        {
            _logger.LogInformation("Sending command {command} to valve {id}", command, valveId);

            UpdateExistingEntityAttributesRequest commandObj;

            if (command == "open")
            {
                commandObj = new OpenCommand();
            }
            else
            {
                commandObj = new CloseCommand();
            }

            var response = await _entitiesApi.UpdateExistingEntityAttributesAsyncWithHttpInfo(
                commandObj,
                "", valveId);

            _logger.LogDebug("Got response {statusCode}", response.StatusCode);
        }
Exemplo n.º 30
0
        static void Main(string[] args)
        {
            Section   cap1 = new Section("Capitolul 1");
            Paragraph p1   = new Paragraph("Paragraph 1");

            cap1.add(p1);
            Paragraph p2 = new Paragraph("Paragraph 2");

            cap1.add(p2);
            Paragraph p3 = new Paragraph("Paragraph 3");

            cap1.add(p3);
            Paragraph p4 = new Paragraph("Paragraph 4");

            cap1.add(p4);
            cap1.add(new ImageProxy("ImageOne"));
            cap1.add(new Image("ImageTwo"));
            cap1.add(new Paragraph("Some text"));
            cap1.add(new Table("Table 1"));

            Section   cap2 = new Section("Capitolul 1");
            Paragraph p12  = new Paragraph("Paragraph 1");

            cap2.add(p12);
            Book book = new Book("Cartea mea");

            book.add(cap1);
            book.add(cap2);
            Command.Command openCommand = new OpenCommand();
            openCommand.execute();

            Command.Command statisticsCommand = new StatisticsCommand();
            statisticsCommand.execute();

            Display display = new Display();

            cap1.accept(display);

            Console.ReadLine();
        }
Exemplo n.º 31
0
        /// <summary>
        /// 开架
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOpen_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cbxGroupNo.Text) || string.IsNullOrEmpty(cbxColumnNo.Text))
            {
                MessageBox.Show("请指定区号和列号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // 列号
            int columnNo = Convert.ToInt32(cbxColumnNo.Text.Substring(0, cbxColumnNo.Text.ToString().Length - 1));
            // 列方向
            string columnDir = cbxColumnNo.Text.Substring(cbxColumnNo.Text.ToString().Length - 1, 1);

            // 开架命令(所有的站号都是1)
            OpenCommand cmd = new OpenCommand(Controller, Convert.ToInt32(cbxGroupNo.Text), columnNo, columnDir);

            commandInvoker.AddCommand(cmd);

            // 执行命令
            //commandInvoker.ExecuteCommand();
            commandInvoker.AsyncExecuteCommand();
        }
Exemplo n.º 32
0
 public void Before_Each_Test()
 {
     mock = MockRepository.GenerateMock<IConsoleFacade>();
     cmd = new OpenCommand(mock);
 }