void hallWindow_StateChanged(object sender, EventArgs e) { HallWindow hwnd = sender as HallWindow; if (hwnd != null) { if (hwnd.WindowState != System.Windows.WindowState.Minimized) { WindowState = System.Windows.WindowState.Minimized; } } }
public RoomWindow(RoomWindowViewModel roomWindowVM, HallWindow hwnd) :base(roomWindowVM) { roomWindowVM.Load(AllWebPages.RoomPage); roomWindowVM.Initialize(); this.roomWindowVM = roomWindowVM; InitializeComponent(); Loaded += RoomWindow_Loaded; hallWindow = hwnd; if(hallWindow != null) hallWindow.StateChanged += hallWindow_StateChanged; }
public RoomWindow(RoomWindowViewModel roomWindowVM, HallWindow hwnd) : base(roomWindowVM) { roomWindowVM.Load(AllWebPages.RoomPage); roomWindowVM.Initialize(); this.roomWindowVM = roomWindowVM; InitializeComponent(); Loaded += RoomWindow_Loaded; hallWindow = hwnd; if (hallWindow != null) { hallWindow.StateChanged += hallWindow_StateChanged; } }
protected override void ProcessMessage(Common.Notification.EnumNotificationMessage<object, LoginWindowAction> message) { switch (message.Action) { case LoginWindowAction.LoginSuccess: break; case LoginWindowAction.InvalidToken: MessageBox.Show(Messages.InvalidToken, Text.Error, MessageBoxButton.OK, MessageBoxImage.Error); break; case LoginWindowAction.UserBlocked: string blockName = message.Content as string; MessageBox.Show(string.Format(Messages.UserBlocked, blockName), Text.Error, MessageBoxButton.OK, MessageBoxImage.Error); break; case LoginWindowAction.CacheLoaded: initUserInfo(); HallWindow hallWnd = new HallWindow(); hallWnd.Show(); this.Close(); break; case LoginWindowAction.Register: RegisterWindowViewModel vm = message.Content as RegisterWindowViewModel; if (vm != null) { registerWnd = new RegisterWindow(vm){Owner = this}; registerWnd.ShowDialog(); } break; case LoginWindowAction.RegisterSuccess: if (registerWnd != null) { registerWnd.Close(); } User user = message.Content as User; if (user != null) { hallVM.ApplicationVM.ProfileVM.LastLoginVM.UserId = user.Id.ToString(); hallVM.ApplicationVM.ProfileVM.LastLoginVM.Password = user.Password; hallVM.ApplicationVM.ProfileVM.LastLoginVM.IconPath = DefaultHeaderIcon; } break; case LoginWindowAction.RegisterUserIdNotAvailable: MessageBox.Show(Messages.NoRegisterUserIdAvailable); break; case LoginWindowAction.RegisterCancel: if (registerWnd != null) registerWnd.Close(); break; default: break; } }