private void SetupUpdate() { MessengerManager.GetInstance().Add(() => { if (!EventbusManager.IsViewOpen(typeof(DevicesView), this._channel)) { return; } EventbusManager.Send<DevicesView, DeviceUpdateCommand>(new DeviceUpdateCommand(CommandMessage.Update), this._channel); }); EventbusManager.Register<DevicesView, DeviceUpdateCommand>(this.ReceiveUpdateCommand); }
private void SetupUpdate() { MessengerManager.GetInstance().Add(() => { if (!EventbusManager.IsViewOpen(typeof(UserlistView), 0)) { return; } EventbusManager.Send <UserlistView, UpdateCommandMessage>(new UpdateCommandMessage(CommandMessage.Update), 0); }); EventbusManager.Register <UserlistView, UpdateCommandMessage>(this.ReceiveUpdateCommand); }
private void ButtonAccept_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(this._viewModel.Username)) { MessageBox.Show("username must be set."); return; } if (string.IsNullOrEmpty(this._viewModel.HostAddress)) { MessageBox.Show("host address must be set."); return; } var service = ServiceConnector.GetInstance(); service.SetAddress(this._viewModel.HostAddress); if (service.TrySetUsername(this._viewModel.Username, out var userItem)) { EventbusManager.OpenView <UserlistView>(0); EventbusManager.Send <MainWindow, UpdateCommandMessage>(new UpdateCommandMessage(userItem), 0); EventbusManager.Send <MenuView, UpdateCommandMessage>(new UpdateCommandMessage(ViewOpen.Userlist), 0); if (!this._viewModel.HostAddressItems.Any(a => a.Equals(this._viewModel.HostAddress))) { this._viewModel.HostAddressItems = this._viewModel.HostAddressItems.Append(this._viewModel.HostAddress); } var settings = new SettingsFile { Username = this._viewModel.Username, Interval = this._viewModel.Interval, ServerAddress = this._viewModel.HostAddress, ServerAddressItems = this._viewModel.HostAddressItems }; UserSettingsLoader.GetInstance().Save(settings); MessengerManager.GetInstance().Start(this._viewModel.Interval); return; } MessageBox.Show($"Can not use username: {this._viewModel.Username}"); }
private void Window_Loaded(object sender, RoutedEventArgs e) { EventbusManager.OpenView <MainView>(0); EventbusManager.Send <MenuView, UpdateCommandMessage>(new UpdateCommandMessage(ViewOpen.Main), 0); EventbusManager.Register <MainWindow, UpdateCommandMessage>(this.UpdateCommandMessageReceived); }
private void ListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e) { EventbusManager.Send <MenuView, UpdateCommandMessage>(new UpdateCommandMessage(ViewOpen.Chat), 0); EventbusManager.Send <ChatView, LoadCommandMessage>(new LoadCommandMessage(this._viewModel.SelectedUser), 0, true); }