public PasswordListViewModel(IMediator mediator) { Add = new AddPasswordCommand(AddPassword); RemoveCommand = new RemovePasswordCommand(RemovePassword); this.mediator = mediator; this.mediator.Register(this); OpenNewWindow = mediator.OpenNewWindow; ShowPopup = new OpenWindowCommand(ShowSettings); CurrentView = mediator.CurrentView; }
public LoginViewmodel(Window window) : base(window) { ExitWindowCommand = new ExitWindowCommand(this); OpenWindowCommand = new OpenWindowCommand(this); ConnectCommand = new ConnectCommand(this); ListenCommand = new ListenCommand(this); User = new User(); Connection = new Connection(); Connection.Actions["ConnectionAccept"] = (Action <Packet>)StartChat; }
public CoreViewModel() { PswFileName = "Passwords"; OpenViews = new ObservableCollection <ViewBase>(); OpenNewWindow = new OpenWindowCommand(SetView); CreateAccount = new CreateAccountCommand(AccountWizard); Login = new LoginCommand(LoginToAccount); passwordManager = new PasswordProvider(); mediator = new ConcreteMediator(OpenNewWindow); mediator.Register(this); }
public MainWindowViewModel() { _container = new UnityContainer(); _container.RegisterType <IUserService, UserService>(); _container.RegisterType <IWorkTimeDispatcherService, WorkTimeDispatcherService>(); _modelUserService = new ModelUserService(_container); _modelWorkTimeDispatcherService = new ModelWorkTimeDispatcherService(_container); Users = _modelUserService.GetUsers(); _workTimeDis = new WorkTimeDispatcherInfo(); ShowDialogCommand = new ShowDialogCommand(PostOpenDialog, PreOpenDialog); OpenWindowCommand = new OpenWindowCommand(); EnterLogin = new RelayCommand(OnEnterLogin); }
public MainViewmodel() : base() { MessengerInstance.Register <NotificationMessage>(this, NotifyMe); ExitWindowCommand = new ExitWindowCommand(this); OpenWindowCommand = new NewConnectionCommand(this); OpenWindowCommand = new OpenWindowCommand(this); OpenHistoryCommand = new OpenHistoryCommand(this); Conversations = new ObservableCollection <Conversation>(); ConversationList = new List <Conversation>(); _history = new History(); foreach (var item in _history.Histories) { ConversationList.Add(item); } Filter = ""; }
void OpenShortcuts(ref Queue <AbstractCursorCommand> cursorCommands) { // Shortcut must be open to don't forget window var shortcuts = GameObject.FindObjectsOfType <Shortcut>(); for (int i = 0; i < shortcuts.Length; i++) { var shortcut = shortcuts[i]; var moveToShortcut = new MoveToCommand(shortcut.transform.position); var openWindow = new OpenWindowCommand(shortcut); cursorCommands.Enqueue(moveToShortcut); cursorCommands.Enqueue(openWindow); } }
public MainWindowViewModel() { OpenWindowCommand = new OpenWindowCommand(); ShowDialogCommand = new ShowDialogCommand(this); }
public MainWindowViewModel() { OpenWindowCommand = new OpenWindowCommand(); }
public Task <CommandCorrelationId> OpenWindow(OpenWindowCommand command) { return(_apiClient.Post <OpenWindowCommand, CommandCorrelationId>("Devices/window-manager/commands/open-window", command)); }
public override void CustomTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.F2 && OpenWindowCommand.CanExecute(null)) { OpenWindowCommand.Execute(null); } else if (e.Key == Key.Enter) { if (string.IsNullOrEmpty(ValueColumn) || string.IsNullOrEmpty(IdColumn) || string.IsNullOrEmpty((sender as CustomTextBox).Text) || (SearchCommand == null && ItemsSource == null)) { ClearLookup(); return; } if (PreviewSelect != null) { var arg = new PreviewSelectEventArgs(); PreviewSelect(this, arg); if (arg.Cancel == true) { ClearLookup(); return; } } LoadData(); if (valueColumnPropInfo == null || idColumnPropInfo == null) { ClearLookup(); return; } if (SelectionMode == LookupSelectionMode.Single) { IEnumerable result = null; if (SearchCommand == null) { try { result = ItemsSource.Where($@"{CodeColumn}=={(sender as CustomTextBox).Text}", null); } catch { ClearLookup(); return; } } else { try { SearchCommand?.Execute(new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>(CodeColumn, $@"{CodeColumn}=={(sender as CustomTextBox).Text}") }); result = ItemsSource; } catch { ClearLookup(); return; } } if (result != null && result.Count() > 0) { ChangeSource = ChangeSourceEnum.FromComponent; foreach (var item in result) { SelectedItem = item; SelectedIndex = GetIndex(item); SelectedId = idColumnPropInfo?.GetValue(item) as int?; break; } ChangeSource = ChangeSourceEnum.None; } else { ClearLookup(); } } else { var strCode = (sender as CustomTextBox).Text.Split(','); for (int i = 0; i < strCode.Length; i++) { strCode[i] = strCode[i].Trim(); } strCode = strCode.Distinct().ToArray(); int counter = 0; var itemList = new List <object>(); var indexList = new List <int>(); var idList = new List <int>(); if (ItemsSource != null) { foreach (var item in ItemsSource) { var code = codeColumnPropInfo?.GetValue(item)?.ToString(); if (!string.IsNullOrEmpty(code)) { if (strCode.Any(x => x == code)) { itemList.Add(item); indexList.Add(counter); var id = idColumnPropInfo?.GetValue(item) as int?; } } counter++; } } if (itemList.Any()) { ChangeSource = ChangeSourceEnum.FromComponent; SelectedItems = itemList; SelectedIndices = indexList; SelectedIds = idList; ChangeSource = ChangeSourceEnum.None; } else { ClearLookup(); } } } }
public MainWindowViewModel() { OpenWindowCommand = new OpenWindowCommand(); ShowDialogCommand = new ShowDialogCommand(PostOpenDialog, PreOpenDialog); }
public async Task <IActionResult> SendWindowManagerOpenWindowCommand([FromBody] OpenWindowCommand command) { return(Ok(await _commandBus.SendAsync(command))); }
public ConcreteMediator(OpenWindowCommand openWindowCommand) { ViewModelList = new List <IViewModel>(); OpenNewWindow = openWindowCommand; }