public ToReactivePropertyAsSynchronizedViewModel(ToReactivePropertyAsSynchronizedModel _model) { Model = _model.AddTo(DisposeCollection); IgnoreValidationErrorValueTrueInput = Model.IgnoreValidationErrorValueTrue.ToReactivePropertyAsSynchronized( x => x.Value, x => x.Name, x => String.IsNullOrEmpty(x) ? ViewName.NullObject : ViewName.Create(x), Reactive.Bindings.ReactivePropertyMode.Default | Reactive.Bindings.ReactivePropertyMode.IgnoreInitialValidationError, true ).SetValidateNotifyError(x => String.IsNullOrEmpty(x) ? "何か入力してください。" : null) .AddTo(DisposeCollection); ShowCommand.Subscribe(() => System.Windows.MessageBox.Show(Model.IgnoreValidationErrorValueTrue.Value.Name)).AddTo(DisposeCollection); IgnoreValidationErrorValueFalseInput = Model.IgnoreValidationErrorValueFalse.ToReactivePropertyAsSynchronized( x => x.Value, x => x.Name, x => String.IsNullOrEmpty(x) ? ViewName.NullObject : ViewName.Create(x), Reactive.Bindings.ReactivePropertyMode.Default | Reactive.Bindings.ReactivePropertyMode.IgnoreInitialValidationError, false ).SetValidateNotifyError(x => String.IsNullOrEmpty(x) ? "何か入力してください。" : null) .AddTo(DisposeCollection); Show2Command.Subscribe(() => System.Windows.MessageBox.Show(Model.IgnoreValidationErrorValueFalse.Value.Name)).AddTo(DisposeCollection); }
static void Main(string[] args) { ICommand command = null; IHostService hostService = null; // Get Host Service for this OS if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { hostService = new WindowsHostService(); } if (hostService is null) { Console.Error.WriteLine("OS is not supported."); Environment.Exit(1); } // Init Command Line App CommandLineApplication commandLineApplication = new CommandLineApplication(); // Show Command commandLineApplication.Command("show", (app) => { command = new ShowCommand(); command.Execute(app, hostService); }); }
public DoctorsViewModel() { ShowEditDoctorViewCommand = new ShowCommand <EditDoctorViewModel>(); LoadDoctorsCommand = new Command(LoadDoctors); ShowEditDoctorViewCommand.Executed += OnEditDoctorFinished; }
public BookViewModel(IFileReader fileReader) { ShowCommand = new ShowCommand(this); UploadCommand = new UploadCommand(this); ClearCommand = new ClearCommand(this); Books = new ObservableCollection <Book>(); _fileReader = fileReader; }
private void Show() { dialogViewModel = new CurrentTimeDialogViewModel(); dialogService.Show(this, dialogViewModel); ShowCommand.RaiseCanExecuteChanged(); ActivateCommand.RaiseCanExecuteChanged(); }
private void Close() { dialogService.Close(dialogViewModel); dialogViewModel = null; ShowCommand.RaiseCanExecuteChanged(); CloseCommand.RaiseCanExecuteChanged(); }
public MainViewModel() { _timer = new Timer(1000); _timer.Elapsed += ProcessTimer; StartTimer(); _showCommand = new ShowCommand(this); }
private void ShowVideo(VideoViewModel video) { if (!ShowCommand.CanExecute(video)) { return; } _navigationService.NavigateTo(ViewModelLocator.VIDEO_DETAILS, video); }
public void Init() { _taskRepository = new TaskRepository(); var project = new Project("secrets"); var task = new Task("Eat more donuts.", project) {Id = 1L}; _taskRepository.Add(task); _fakeConsole = Substitute.For<IConsole>(); _showCommand = new ShowCommand(_fakeConsole, _taskRepository); }
public AppNotifyIcon(IContainer container) { container.Add(this); InitializeComponent(); notifyIcon.Icon = Resources.Resource.timermaid; notifyIcon.DoubleClick += (sender, e) => ShowCommand?.Execute(null); notifyIconMenuShow.Click += (sender, e) => ShowCommand?.Execute(null); notifyIconMenuQuit.Click += (sender, e) => QuitCommand?.Execute(null); }
public async Task <int> Execute(string[] args) { var rootCommand = new RootCommand("Party: A Virt-A-Mate package manager") { HelpCommand.CreateCommand(_renderer, _config, _controllerFactory), SearchCommand.CreateCommand(_renderer, _config, _controllerFactory), GetCommand.CreateCommand(_renderer, _config, _controllerFactory), ShowCommand.CreateCommand(_renderer, _config, _controllerFactory), StatusCommand.CreateCommand(_renderer, _config, _controllerFactory), UpgradeCommand.CreateCommand(_renderer, _config, _controllerFactory), PublishCommand.CreateCommand(_renderer, _config, _controllerFactory), CleanCommand.CreateCommand(_renderer, _config, _controllerFactory), }; // For CoreRT: rootCommand.Name = Path.GetFileName(Environment.GetCommandLineArgs().FirstOrDefault()) ?? "party.exe"; Exception exc = null; var parser = new CommandLineBuilder(rootCommand) .UseVersionOption() .UseHelp() #if DEBUG .UseParseDirective() .UseDebugDirective() #endif .UseSuggestDirective() // .RegisterWithDotnetSuggest() .UseTypoCorrections() .UseParseErrorReporting() .UseExceptionHandler((e, ctx) => exc = e) .CancelOnProcessTermination() .Build(); _renderer.WriteLine("Party, a Virt-A-Mate package manager, is still in it's early stages. Please file any issue or ideas at https://github.com/vam-community/vam-party/issues", ConsoleColor.Green); try { await parser.InvokeAsync(args, _renderer); } catch (Exception e) { exc = e; } if (exc != null) { return(HandleError(exc)); } return(0); }
public void Run() { ICommand showCommand = new ShowCommand("20小锤"); ICommand saveCommand1 = new SaveCommand(new DBSaver(), "20小锤"); ICommand saveCommand2 = new SaveCommand(new LocalSaver(), "20小锤"); ShowAndSaveInvoker invoker = new ShowAndSaveInvoker(); invoker.SetSaveCommand(saveCommand1); invoker.SetShowCommand(showCommand); invoker.ShowAndSave(); Console.WriteLine("test another saver"); invoker.SetSaveCommand(saveCommand2); invoker.ShowAndSave(); }
static int Main(string[] args) { var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: false) .AddEnvironmentVariables("ChangeLog:") .AddCommandLine(args) .Build(); var githubSettings = new GithubSettings(); configuration.Bind(githubSettings); var gitSettings = new GitSettings(); configuration.Bind(gitSettings); var cosmosDbSettings = new CosmosDbSettings(); configuration.Bind(cosmosDbSettings); var gitHubService = new GithubService(githubSettings); var gitService = new GitService(gitSettings); var cosmoDbRepository = new CosmosDbRepository(cosmosDbSettings); var directAccessRepository = new DirectAccessChangeLogRepository(gitHubService, gitService); var app = new CommandLineApplication(); app.HelpOption(inherited: true); var showCommand = new ShowCommand(cosmoDbRepository, directAccessRepository); var loadCommand = new LoadCommand(cosmoDbRepository, directAccessRepository); app.Command("show", showCommand.Configure); app.Command("load", loadCommand.Configure); app.OnExecute(() => { Console.WriteLine("Specify a subcommand"); app.ShowHelp(); return(1); }); return(app.Execute(args)); }
private void ToolTip_Opened(object sender, RoutedEventArgs e) { if (ToolTipOnDemand) { var toolTip = sender as ToolTip; toolTip.Visibility = toolTip.ActualWidth < AssociatedObject.ActualWidth ? Visibility.Hidden : Visibility.Visible; //toolTip.MinWidth = AssociatedObject.ActualWidth; //toolTip.MinHeight = AssociatedObject.ActualHeight; } if (ShowCommand != null) { if (ShowCommand.CanExecute(AssociatedObject?.DataContext)) { ShowCommand.Execute(AssociatedObject?.DataContext); } } }
public ContentViewModel(IDialogService _dialogService) { DialogService = _dialogService; RequestNavigateCommand .Subscribe(() => RegionNavigationService.RequestNavigate(nameof(CustomDialogView), new NavigationParameters { { "Input", Input.Value } })) .AddTo(DisposeCollection); ShowDialogCommand .Subscribe(() => { IDialogResult result = null; DialogService.ShowDialog(nameof(CustomDialogView), new DialogParameters { { "Input", Input.Value } }, ret => result = ret); if (result != null) { Input.Value = result.Parameters.GetValue <string>("Input"); } }).AddTo(DisposeCollection); ShowCommand .Subscribe(async() => { var trigger = new Subject <IDialogResult>(); var result = trigger.ToReadOnlyReactivePropertySlim(); DialogService.Show(nameof(CustomDialogView), new DialogParameters { { "Input", Input.Value } }, trigger.OnNext); await result; Input.Value = result.Value.Parameters.GetValue <string>("Input"); }).AddTo(DisposeCollection); }
sealed public override void RetrieveCommands() { // Add all command and responses needed for configuring the BLE module. Command command = new AtCommand("AT"); _commands.Add(command); //command = new NotificationCommand("AT+NOTI1"); //_commands.Add(command); command = new AddressCommand("AT+ADDR?"); _commands.Add(command); command = new NameCommand("AT+NAME?"); _commands.Add(command); command = new FilterCommand("AT+FILT1"); _commands.Add(command); command = new ShowCommand("AT+SHOW1"); _commands.Add(command); command = new RoleCommand("AT+ROLE1"); _commands.Add(command); command = new IMMECommand("AT+IMME1"); _commands.Add(command); command = new DiscoveryCommand("AT+DISC?"); _commands.Add(command); command = new ConnectCommand("AT+CON{0}"); _commands.Add(command); command = new StartCommand("AT+START"); _commands.Add(command); }
static void ExecuteCommand() { string strCommand = Console.ReadLine().Trim(); if (strCommand.Length == 0) { strCommand = " "; } char command = strCommand[0]; IEmptyCommand icommand = null; object obj = null; try { switch (command) { case 'I': icommand = new CreateCommand(strCommand); break; case 'C': icommand = new ClearCommand(strCommand, img); break; case 'L': icommand = new PixelColorCommand(strCommand, img); break; case 'V': icommand = new DrawVerticalCommand(strCommand, img); break; case 'H': icommand = new DrawHorizontalCommand(strCommand, img); break; case 'F': icommand = new RegionCommand(strCommand, img); break; case 'S': icommand = new ShowCommand(strCommand, img); break; case 'X': Environment.Exit(0); break; default: throw new Exception("No valid Command"); } if (icommand != null) { obj = icommand.ExecuteCommand(img); if (obj is String) { Console.Write(Convert.ToString(obj)); Console.Write(Environment.NewLine); } else if (obj is Image) { img = (Image)obj; } } }catch (Exception ex) { Console.Write(ex.Message); Console.Write(Environment.NewLine); } }
public void Execute(ShowCommand command) { command.Filter.ShowInFilter(command.Node, command.Position); }
public void Load(string linkFileName) { if (null == linkFileName) { throw new ArgumentNullException("linkFileName", "A name of the link file cannot be null"); } if (!File.Exists(linkFileName)) { throw new FileNotFoundException("Link not found", linkFileName); } new FileIOPermission(FileIOPermissionAccess.Read | FileIOPermissionAccess.PathDiscovery, linkFileName).Demand(); object sl = null; try { Type slType = Type.GetTypeFromCLSID(CLSID_ShellLink); sl = Activator.CreateInstance(slType); IPersistFile pf = sl as IPersistFile; pf.Load(linkFileName, 0); int showCmd; StringBuilder builder = new StringBuilder(INFOTIPSIZE); IShellLinkW shellLinkW = sl as IShellLinkW; if (null == shellLinkW) { IShellLinkA shellLinkA = sl as IShellLinkA; if (null == shellLinkA) { ThrowInvalidComObjectException(); } shellLinkA.GetArguments(builder, builder.Capacity); this.arguments = builder.ToString(); shellLinkA.GetDescription(builder, builder.Capacity); this.description = builder.ToString(); shellLinkA.GetHotkey(out this.hotkey); shellLinkA.GetIconLocation(builder, builder.Capacity, out this.iconIndex); this.iconPath = builder.ToString(); Win32FindDataA wfd; shellLinkA.GetPath(builder, builder.Capacity, out wfd, SLGP_UNCPRIORITY); this.path = builder.ToString(); shellLinkA.GetShowCmd(out showCmd); shellLinkA.GetWorkingDirectory(builder, builder.Capacity); this.workingDirectory = builder.ToString(); } else { shellLinkW.GetArguments(builder, builder.Capacity); this.arguments = builder.ToString(); shellLinkW.GetDescription(builder, builder.Capacity); this.description = builder.ToString(); shellLinkW.GetHotkey(out this.hotkey); shellLinkW.GetIconLocation(builder, builder.Capacity, out this.iconIndex); this.iconPath = builder.ToString(); Win32FindDataW wfd; shellLinkW.GetPath(builder, builder.Capacity, out wfd, SLGP_UNCPRIORITY); this.path = builder.ToString(); shellLinkW.GetShowCmd(out showCmd); shellLinkW.GetWorkingDirectory(builder, builder.Capacity); this.workingDirectory = builder.ToString(); } this.showCmd = (ShowCommand)showCmd; } finally { if (null != sl) { Marshal.ReleaseComObject(sl); } } // This object is not eligible for the garbage collection during this method call GC.KeepAlive(this); }
public ClinicViewModel() { ShowDoctorsViewCommand = new ShowCommand <DoctorsViewModel>(); }
/// <summary> /// Shows the interstitial command handler. /// </summary> /// <param name="cmd">Cmd.</param> protected void ShowCommandHandler(ShowCommand cmd) { _advertisementService.Show(); }