public ListenerCommand <T> Get(Action <T> execute, Func <bool> canExecute = null) { if (_Command == null) { _Command = new ListenerCommand <T>(execute); } return(_Command); }
public MainWindowViewModel() { this._selectedMenuCommand = new ListenerCommand<MENU_ITEMS>(this.TransitSearchMenu); this.CurrentView = new SearchViewModelBase(); this._menus = new Dictionary<MENU_ITEMS, SearchViewModelBase>() { { MENU_ITEMS.SEARCH_CATEGORY, new SearchCategoryViewModel() } }; }
public async Task Handle(ListenerCommand <EmailMessage> message, IMessageHandlerContext context) { log.Info($"Sending Email: {message.Id} to {message.Message.ToAdress}"); message.Message.FromAdress = new MailAddress(ConfigurationManager.AppSettings["EmailAdress"], $"LNU Emailer"); try { await emailService.SendMailAsync(message.Message); } catch (Exception e) { log.Error("[WHoops] Email sending failed", e); } }
/// <summary> /// コマンドのインスタンス生成のためのヘルパーメソッドです。 /// </summary> /// <typeparam name="T">任意の型</typeparam> /// <param name="self">ViewModel</param> /// <param name="command">ListenerCommand<T></param> /// <param name="execute">実行処理</param> /// <param name="canExecute">実行処理の実行有無</param> /// <returns>ListenerCommand<T></returns> public static ListenerCommand <T> SetCommand <T>(this ViewModel self, ref ListenerCommand <T> command, Action <T> execute, Func <bool> canExecute = null) { if (command == null) { if (canExecute == null) { canExecute = () => true; } command = new ListenerCommand <T>(execute, canExecute); } return(command); }
static void Main(string[] args) { StartUp.GetStarted(); Jobs = new List <Job>(); // _threads = new List<Thread>(); // Threads.TestThreads(); int c = ThreadPool.ThreadCount; Console.WriteLine("ThreadsNumber: " + c); ThreadPool.SetMaxThreads(3200000, 999); ThreadPool.SetMinThreads(10000, 10000); c = ThreadPool.ThreadCount; Console.WriteLine("ThreadsNumber: " + c); Operations = new List <string>(); Reports = new List <Report>(); // DeletePreviousRender(); ListenerCommand.StartThread(); tasks = new List <RenderTask>(); while (true) { Report.CreaterReports(); Job.FindVrayRGBColorRenderMask(Path.GetFullPath("C://Dropbox//")); Job.FindVrayRGBColorRenderMask(Path.GetFullPath("r://Mars//")); while (Operations.Count > 0) { Thread newThread = new Thread(RunOperation); newThread.Start(); Thread.Sleep(200); } Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\n"); Console.WriteLine("\nСледующая проверка через: \n"); for (int i = 0; i < iteration; i++) { Thread.Sleep(1000); Tools.ClearCurrentConsoleLine(); Console.Write((iteration - i).ToString() + " "); } } }
public DisplayWindowViewModel() { Task.Run(async() => { IpAddr = (await Dns.GetHostAddressesAsync(Dns.GetHostName())) .Where(x => x.AddressFamily == AddressFamily.InterNetwork) .JoinToString(); }); VlcExeSelectionCommand = new ListenerCommand <OpeningFileSelectionMessage>(m => { VlcExe = m?.Response?[0] ?? VlcExe; }); ExecuteVlcCommand = new ViewModelCommand(() => { VlcRunService.Run(new FileInfo(VlcExe)); }); }