public void OpenCommand_Executed(object sender, RoutedEventArgs e) { OpenFileDialog mOpenFileDialog = new OpenFileDialog(); mOpenFileDialog.Filter = "XML Files (*.xml)|*.xml|All files (*.*)|*.*"; if (mOpenFileDialog.ShowDialog() == true) { string path = mOpenFileDialog.FileName; System.Threading.Tasks.Task.Factory.StartNew(() => { try { OpenFileCommand OpenFileCommand = new OpenFileCommand(this, path); OpenFileCommand.Execute(); Hub.Invoke("ClientRequestTaskList"); } catch (AggregateException error) { MessageBox.Show(error.Message); } }); //MessageBox.Show("Open Completed!", "Open", MessageBoxButton.OK, MessageBoxImage.Information); } }
private async void OnItemSelected(object selectedItem) { if (_isSelecting) { return; // still selecting something } try { _isSelecting = true; if (selectedItem is FileItem fileItem) { if (OpenFileCommand?.CanExecute(OpenFileCommandParameter) ?? false) { OpenFileCommand.Execute(OpenFileCommandParameter); } } else { IsBusy = true; await Adapter.OpenItemAsync(selectedItem as FileSystemItemBase); } } catch (Exception ex) { await Adapter.OnErrorAsync(ex); } finally { _isSelecting = false; IsBusy = false; } }
public SettingsPageModel(PasswordBox PasswordBox) { this.PasswordBox = PasswordBox; this.PasswordBox.PasswordChanged += (i1, i2) => SyncSettingsBindings(); Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); KeyValueConfigurationElement KeyValueConfigurationElement = configuration.AppSettings.Settings[Configurations.SERVICE_PATH]; if (KeyValueConfigurationElement is object) { Path = KeyValueConfigurationElement.Value; } else { Path = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), System.IO.Path.ChangeExtension(Configurations.SERVICE_NAME, ".exe")); } SelectServiceFileCommand = new OpenFileCommand(Path => { this.Path = Path; configuration.AppSettings.Settings.Remove(Configurations.SERVICE_PATH); configuration.AppSettings.Settings.Add(Configurations.SERVICE_PATH, Path); configuration.Save(); }, Configurations.SERVICE_NAME + " Executable|" + System.IO.Path.ChangeExtension(Configurations.SERVICE_NAME, ".exe")); SelectInputPathCommand = new OpenFolderCommand(Path => InputPath = Path); SelectOutputPathCommand = new OpenFolderCommand(Path => OutputPath = Path); SelectProcessedPathCommand = new OpenFolderCommand(Path => ProcessedPath = Path); SelectErrorPathCommand = new OpenFolderCommand(Path => ErrorPath = Path); SelectSurfacePathCommand = new OpenFolderCommand(Path => SurfacePath = Path); SelectAnalysisPathCommand = new OpenFolderCommand(Path => AnalysisPath = Path); StopServiceCommand = new WrappedCommand(new StopServiceCommand(Configurations.SERVICE_NAME)); }
public MainWindowViewModel(VideoPlayer videoPlayerIn) { this.exportQueueViewModel = new ExportQueueViewModel(); OpenFileCommand = new OpenFileCommand(this, videoPlayerIn); OpenExportQueueCommand = new OpenExportQueueCommand(this, this.exportQueueViewModel); OpenSettingsCommand = new OpenSettingsCommand(this); OpenAboutCommand = new OpenAboutCommand(this); PlayOrPauseCommand = new PlayOrPauseCommand(this, videoPlayerIn); SetSectionStartCommand = new SetSectionStartCommand(this, videoPlayerIn); SetSectionEndCommand = new SetSectionEndCommand(this, videoPlayerIn); BackwardCommand = new BackwardCommand(this, videoPlayerIn); ForwardCommand = new ForwardCommand(this, videoPlayerIn); StepBackwardCommand = new SeekCommand(this, videoPlayerIn, () => - videoPlayerIn.FrameTime); StepForwardCommand = new SeekCommand(this, videoPlayerIn, () => videoPlayerIn.FrameTime); Step1sBackwardCommand = new SeekCommand(this, videoPlayerIn, () => - TimeSpan.FromSeconds(1)); Step1sForwardCommand = new SeekCommand(this, videoPlayerIn, () => TimeSpan.FromSeconds(1)); PlayFromSelectionStartCommand = new PlayFromSelectionStartCommand(this, videoPlayerIn); PlaySelectionCommand = new PlaySelectionCommand(this, videoPlayerIn); PlayUntilSelectionEndCommand = new PlayUntilSelectionEndCommand(this, videoPlayerIn); ExportSelectionCommand = new ExportSelectionCommand(this); NextVideoCommand = new NextVideoCommand(this, videoPlayerIn); AddToQueueCommand = new AddToQueueCommand(this, this.exportQueueViewModel); AudioVolume = ApplicationSettings.AudioVolume; }
private void OpenFile() { Vault.Currency.Entities.FileIteration file = m_model.SelectedContent.FirstOrDefault() as Vault.Currency.Entities.FileIteration; if (file != null) { OpenFileCommand.Execute(file, m_conn); } }
public MainViewModel() { DrawCommand = new DrawCommand(this); ClearCommand = new ClearCommand(this); RebuildCommand = new RebuildCommand(this); OpenFileCommand = new OpenFileCommand(this); ExitCommand = new ExitCommand(); }
/// <summary> /// Initializes a new instance of the ConfigurationDataEditorViewModel class. /// </summary> public ConfigurationDataEditorViewModel() { b_Title = $"OPC UA Application Configuration Editor Rel: {Assembly.GetExecutingAssembly().GetName().Version}"; SaveCommand = new Prism.Commands.DelegateCommand(() => { }); HelpDocumentation = new WebDocumentationCommand(Properties.Resources.HelpDocumentationUrl); ReadMe = new OpenFileCommand(Properties.Resources.ReadMeFileName); ViewLicense = new WebDocumentationCommand(Properties.Resources.ViewLicenseUrl); }
/// <summary> /// Initializes a new instance of the <see cref="EditorControl"/> class. /// </summary> public EditorControl() { SaveAsCommand = new SaveAsCommand(this); SaveCommand = new SaveCommand(this); OpenFileCommand = new OpenFileCommand(this); NewFileCommand = new NewFileCommand(this); InsertImageCommand = new InsertImageCommand(this); }
void OpenFileImpl(OpenFileCommand command) { string xmlFilePath = command.XmlFilePath; OpenInternal(xmlFilePath); //clear the clipboard to avoid copying between dyns ClipBoard.Clear(); }
public OpenTxtFileWindow() { InitializeComponent(); openFileCommand = new OpenFileCommand(); openFileCommand.OnOpened += OpenCommand_OnOpened; openTxtFileButton.Command = openFileCommand; }
public void OpenFile(object sender, RoutedEventArgs arguments) { var openCommand = new OpenFileCommand(); openCommand.Execute(arguments); LoadSource(openCommand.MappingsSource); }
/// <summary> /// コンストラクタ /// </summary> public MainWindowViewModel() { ConfirmationCommand.Subscribe(ConfirmationMethod).AddTo(Disposable); InformationCommand.Subscribe(_ => ShowInformationDialog("メッセージ", "タイトル", MessageBoxImage.Error)).AddTo(Disposable); OpenFileCommand.Subscribe(OpenFileMethod).AddTo(Disposable); SaveFileCommand.Subscribe(SaveFileMethod).AddTo(Disposable); ClosedCommand.Subscribe(Close).AddTo(Disposable); }
public MainWindowViewModel() { Zero = settingModel.ToReactivePropertyAsSynchronized(x => x.Zero); One = settingModel.ToReactivePropertyAsSynchronized(x => x.One); Two = settingModel.ToReactivePropertyAsSynchronized(x => x.Two); Three = settingModel.ToReactivePropertyAsSynchronized(x => x.Three); Four = settingModel.ToReactivePropertyAsSynchronized(x => x.Four); Five = settingModel.ToReactivePropertyAsSynchronized(x => x.Five); Six = settingModel.ToReactivePropertyAsSynchronized(x => x.Six); Seven = settingModel.ToReactivePropertyAsSynchronized(x => x.Seven); Eight = settingModel.ToReactivePropertyAsSynchronized(x => x.Eight); Nine = settingModel.ToReactivePropertyAsSynchronized(x => x.Nine); Ten = settingModel.ToReactivePropertyAsSynchronized(x => x.Ten); Eleven = settingModel.ToReactivePropertyAsSynchronized(x => x.Eleven); Twelve = settingModel.ToReactivePropertyAsSynchronized(x => x.Twelve); Thirteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Thirteen); Fourteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Fourteen); Fifteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Fifteen); Sixteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Sixteen); Seventeen = settingModel.ToReactivePropertyAsSynchronized(x => x.Seventeen); Eighteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Eighteen); Nineteen = settingModel.ToReactivePropertyAsSynchronized(x => x.Nineteen); Twenty = settingModel.ToReactivePropertyAsSynchronized(x => x.Twenty); Twentyone = settingModel.ToReactivePropertyAsSynchronized(x => x.Twentyone); Twentytwo = settingModel.ToReactivePropertyAsSynchronized(x => x.Twentytwo); Twentythree = settingModel.ToReactivePropertyAsSynchronized(x => x.Twentythree); OpenFileCommand.Subscribe(x => ButtonAction(x)); PlayCommand.Subscribe(x => PlayAction(x)); StartCommand.Subscribe(_ => StartAction()); StopCommand.Subscribe(_ => StopAction()); }
protected virtual void OpenFileImpl(OpenFileCommand command) { string xmlFilePath = command.XmlFilePath; OpenFileFromPath(xmlFilePath); //clear the clipboard to avoid copying between dyns //ClipBoard.Clear(); }
protected virtual void OpenFileImpl(OpenFileCommand command) { string xmlFilePath = command.XmlFilePath; bool forceManualMode = command.ForceManualExecutionMode; OpenFileFromPath(xmlFilePath, forceManualMode); //clear the clipboard to avoid copying between dyns //ClipBoard.Clear(); }
void OpenFileImpl(OpenFileCommand command) { string xmlFilePath = command.XmlFilePath; OpenInternal(xmlFilePath); //clear the clipboard to avoid copying between dyns ClipBoard.Clear(); }
protected virtual void OpenFileImpl(OpenFileCommand command) { string filePath = command.FilePath; bool forceManualMode = command.ForceManualExecutionMode; OpenFileFromPath(filePath, forceManualMode); //clear the clipboard to avoid copying between dyns //ClipBoard.Clear(); }
public ExportCompletedViewModel(string title, FileInfo file) { Title = title; File = file; OpenFileCommand = ReactiveCommand.Create(this.WhenAnyValue(me => me.File).Select(f => f?.Exists == true)); OpenFolderCommand = ReactiveCommand.Create(this.WhenAnyValue(me => me.File).Select(f => f?.Directory?.Exists == true)); OpenFileCommand.Subscribe(_ => Process.Start(File.FullName)); OpenFolderCommand.Subscribe(_ => Process.Start(File.DirectoryName)); Result = CloseCommand.Select(_ => (bool?)true); }
public MusicPlayingState(FileHandler fileHandler) { this._fileHandler = fileHandler; /* commands in the chain that can be executed when music is playing */ BaseCommand command = null; _firstInChain = command = new OpenFileCommand(); command.SetNextChain(command = new SaveAsPDFCommand()); command.SetNextChain(command = new SaveAsLilypondCommand()); }
public EventToReactiveViewModel() { MousePosition = new ReactivePropertySlim <string>() .AddTo(Disposables); CanExecute = new ReactivePropertySlim <bool>(true) .AddTo(Disposables); OpenFileCommand = CanExecute.ToReactiveCommand <string>() .AddTo(Disposables); OpenedFile = OpenFileCommand.Select(x => $"You selected {x}") .ToReadOnlyReactivePropertySlim() .AddTo(Disposables); }
public MainViewModel() { OpenFileCommand = new OpenFileCommand(this); FilterBestTradesCommand = new FilterBestTradesCommand(this); FilterWorstTradesCommand = new FilterWorstTradesCommand(this); FilterClearCommand = new FilterClearCommand(this); Trades = new TradeCollection(); Filters = new ObservableCollection <FilterViewModel>(); Title = "Testing Results Analyzer"; InitFilters(); FilterMax = "10"; }
private void OpenFileImpl(OpenFileCommand command) { this.VisualizationManager.Pause(); string xmlFilePath = command.XmlFilePath; model.OpenInternal(xmlFilePath); this.AddToRecentFiles(xmlFilePath); //clear the clipboard to avoid copying between dyns model.ClipBoard.Clear(); this.VisualizationManager.UnPause(); }
private void OpenFileImpl(OpenFileCommand command) { this.VisualizationManager.Pause(); string xmlFilePath = command.XmlFilePath; model.OpenInternal(xmlFilePath); this.AddToRecentFiles(xmlFilePath); //clear the clipboard to avoid copying between dyns model.ClipBoard.Clear(); this.VisualizationManager.UnPause(); }
public override Request Handle(Request request) { if (!request.Shortcut.Contains(_shortcut)) { return(base.Handle(request)); } var command = new OpenFileCommand(_callback); _invoker.SetCommand(command); _invoker.ExecuteCommand(); request.Shortcut.Clear(); return(request); }
/// <summary> /// Handles UI buttons and activates the command pattern /// </summary> private async void UserActionClick(object sender, RoutedEventArgs e) { if (sender is AppBarButton button) { IUserActionCommand cmd = null; switch (button.Name) { case "OpenButton": cmd = new OpenFileCommand(this); break; case "SaveButton": cmd = new SaveFileCommand(); break; case "RedoButton": cmd = new RedoCommand(this); break; case "UndoButton": cmd = new UndoCommand(this); break; case "GroupButton": cmd = new GroupCommand(this); break; case "UnGroupButton": cmd = new UnGroupCommand(this); break; case "DeleteButton": cmd = new DeleteItemCommand(this); break; } if (cmd != null) { cmd.RedoStack = _redoStack; cmd.UndoStack = _undoStack; cmd.ShapeList = _shapeList; await _userInvoker.InvokeUserActionAsync(cmd); } } }
public void Command() { var mockFileByOpen = new MockCommand(); var mockFileByClose = new MockCommand(); ICommand commadOpen = new OpenFileCommand(mockFileByOpen); ICommand commadClose = new CloseFileCommand(mockFileByClose); commadOpen.Execute(); commadClose.Execute(); Assert.IsTrue(mockFileByOpen.InvokedOpen); Assert.IsTrue(mockFileByClose.InvokedClose); Assert.IsFalse(mockFileByOpen.InvokedClose); Assert.IsFalse(mockFileByClose.InvokedOpen); }
/// <summary> /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class. /// </summary> public MainWindowViewModel() { b_ConsumerLog = new ObservableCollection <string>(); //Menu Files b_ConfigurationFolder = new ConfigurationFolderCommand(); b_HelpDocumentation = new WebDocumentationCommand(Properties.Resources.HelpDocumentationUrl); //Menu Actions b_OpenConsumerConfiguration = new ConfigurationEditorOpenCommand(Properties.Resources.ConfigurationDataConsumerFileName, SaveResponse); b_OpenProducerConfiguration = new ConfigurationEditorOpenCommand(Properties.Resources.ConfigurationDataProducerFileName, SaveResponse); //Menu Help b_ReadMe = new OpenFileCommand(Properties.Resources.ReadMeFileName); b_TermsOfService = new WebDocumentationCommand(Properties.Resources.TermsOfServiceUrl); b_ViewLicense = new WebDocumentationCommand(Properties.Resources.ViewLicenseUrl); String _version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); b_WindowTitle = $"OPC UA Example Application Rel. {_version} supporting PubSup protocol 1.10"; }
private void ToolbarButton_Click(object sender, RoutedEventArgs e) { try { switch ((sender as FrameworkElement).Tag.ToString().Replace("toolbar.", "")) { case "new": NewFileCommand.Execute(null); break; case "open": OpenFileCommand.Execute(null); break; case "save": SaveFileCommand.Execute(null); break; case "cut": CutCommand.Execute(null); break; case "copy": CopyCommand.Execute(null); break; case "paste": PasteCommand.Execute(null); break; case "build": BuildRunCommand.Execute(false); break; case "buildrun": BuildRunCommand.Execute(true); break; case "close": CloseTabCommand.Execute(null); break; } } catch (Exception ex) { Debug.Fail(ex.Message); } }
public MusicEditingState(FileHandler fileHandler) { this._fileHandler = fileHandler; /* commands in the chain that can be executed when music is in editing mode */ BaseCommand command = null; _firstInChain = command = new ClefTrebleCommand(); command.SetNextChain(command = new TempoCommand()); command.SetNextChain(command = new Time34Command()); command.SetNextChain(command = new Time44Command()); command.SetNextChain(command = new Time44Command("LeftAltT4")); command.SetNextChain(command = new Time68Command()); command.SetNextChain(command = new BarlineCommand()); command.SetNextChain(command = new OpenFileCommand()); command.SetNextChain(command = new SaveAsPDFCommand()); command.SetNextChain(command = new SaveAsLilypondCommand()); }
public static void InvokeCommand() { IAccessible file = new Archive(); ICommand fileClose = new CloseFileCommand(file); ICommand fileOpen = new OpenFileCommand(file); ICommand fileCopy = new CopyFileCommand(file); ICommand filePaste = new PasteFileCommand(file); Access command = new Access(fileClose, fileOpen, fileCopy, filePaste); string [] orders = { "close", "open", "close", "close", "copy", "paste", "paste", "batata" }; foreach (string ordem in orders) { switch (ordem) { case "open": Console.Write("Comando " + ordem + ": "); command.Open(); break; case "close": Console.Write("Comando " + ordem + ": "); command.Close(); break; case "copy": Console.Write("Comando " + ordem + ": "); command.Copy(); break; case "paste": Console.Write("Comando " + ordem + ": "); command.Paste(); break; default: Console.WriteLine("Comando " + ordem + ": Comando Inválido"); break; } } Console.ReadLine(); }
private void InitializeCommands() { NewProjectCommand = new NewProjectCommand(this); SaveChangesCommand = new SaveChangesCommand(this); RemoveSelectedNewActionCommand = new RemoveSelectedNewActionCommand(this); OpenFileCommand = new OpenFileCommand(this); ExecuteActionCommand = new ExecuteActionCommand(this); OpenAddActionDialogCommand = new OpenAddActionDialogCommand(this); CloseAddActionDialogCommand = new CloseAddActionDialogCommand(this); RegisterCommand(NewProjectCommand); RegisterCommand(SaveChangesCommand); RegisterCommand(RemoveSelectedNewActionCommand); RegisterCommand(OpenFileCommand); RegisterCommand(ExecuteActionCommand); RegisterCommand(OpenAddActionDialogCommand); RegisterCommand(CloseAddActionDialogCommand); RaiseCanExecuteCommandChanged(); }
public MainViewModel(MusicLoader musicLoader) { CurrentState = new Saved(this); _pressedKeys = new List <Key>(); _keyHandlerChain = new CommandKeyHandler(); RegularKeyHandler keyHandlerChain2 = new RegularKeyHandler(); RegularKeyHandler keyHandlerChain3 = new RegularKeyHandler(); _keyHandlerChain.Next = keyHandlerChain2; keyHandlerChain2.Next = keyHandlerChain3; _commands = new Dictionary <string, IEditorCommand>(); IEditorCommand saveCommand = new OpenFileCommand(); _commands.Add(saveCommand.Pattern, saveCommand); _musicLoader = musicLoader; FileName = @"Files/Alle-eendjes-zwemmen-in-het-water.mid"; }
public void OpenCommand_Executed(object sender, RoutedEventArgs e) { try { OpenFileDialog mOpenFileDialog = new OpenFileDialog(); mOpenFileDialog.Filter = "XML Files (*.xml)|*.xml|All files (*.*)|*.*"; //string folderLocation = FOLDER_LOCATION; //mOpenFileDialog.InitialDirectory = @folderLocation; if (mOpenFileDialog.ShowDialog() == true) { string path = mOpenFileDialog.FileName; OpenFileCommand OpenFileCommand = new OpenFileCommand(this, path); OpenFileCommand.Execute(); this.ViewableTasks.View.Refresh(); } } catch (Exception e2) { MessageBox.Show(e2.Message); } }
private void OpenFileImpl(OpenFileCommand command) { string xmlFilePath = command.XmlFilePath; dynSettings.Controller.DynamoModel.OpenInternal(xmlFilePath); }