//override public void onRecieveResult(Dictionary <String, Object> bundle) { Object senderName; Object senderValue; bundle.TryGetValue(PageDataExchange.KEY_SENDER_NAME, out senderName); bundle.TryGetValue(PageDataExchange.KEY_SENDER_VALUE, out senderValue); string action = senderValue.ToString(); if (PageLogin.LOGIN.Equals(action) || PageLogin.LOGOUT.Equals(action)) { String title = String.Empty; String info = String.Empty; Dictionary <String, Object> pagedata = new Dictionary <string, object>(); PageDataExchange context = PageDataExchange.getInstance(); if (PageLogin.LOGIN.Equals(action)) { bundle.Add(PageUserRegister.USER_PAGE, PageUserRegister.ID_LOGIN); context.putExtra(PageUserRegister.TAG, bundle); Utils.NavigateToPage(MainWindow.sFrameReportName, PageUserRegister.TAG); } else if (PageLogin.LOGOUT.Equals(action)) { bundle.Add(PageUserActionResult.TITLE, "用户登出"); bundle.Add(PageUserActionResult.INFO, "用户" + User.GetInstance().GetCurrentUserInfo().Account + "已登出!"); context.putExtra(PageUserActionResult.TAG, bundle); Utils.NavigateToPage(MainWindow.sFrameReportName, PageUserActionResult.TAG, false); } } }
private void btn_del_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; String account = btn.Tag.ToString(); Boolean success = User.GetInstance().deleteUser(account); String title = "删除用户"; String info = "用户" + account + "已删除!"; Dictionary <String, Object> bundle = new Dictionary <string, object>(); bundle.Add(PageUserActionResult.TITLE, title); bundle.Add(PageUserActionResult.INFO, info); mContext.putExtra(PageUserActionResult.TAG, bundle); Utils.NavigateToPage(MainWindow.sFrameReportName, PageUserActionResult.TAG, false); }
private void btn_action_verify_click(object sender, RoutedEventArgs e) { String username = this.tb_account.Text; String password1 = this.pb_password0.Password; String password2 = this.pb_password1.Password; int roleIndex = (int)this.register_role_list.SelectedValue; String title = String.Empty; String info = String.Empty; int status = ACTION_FAILED_LOGIN; Boolean success = false; if (mPageId == ID_LOGIN) { success = User.GetInstance().Login(username, password1); if (success) { title = "登录成功!"; info = "用户" + username + "已登陆!"; status = ACTION_SUCCESSED_LOGIN; } else { title = "登录失败!"; info = "错误的用户名或密码!"; } } else if (mPageId == ID_REGISTER) { if (!String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password1) && password1.Equals(password2)) { success = User.GetInstance().registerUser(username, password1, roleIndex); } if (success) { title = "注册成功!"; info = "用户" + username + "已注册!"; } else { title = "注册失败!"; info = "已存在的用户名或两次密码输入不一致!"; } } Dictionary <String, Object> bundle = new Dictionary <string, object>(); bundle.Add(PageUserActionResult.TITLE, title); bundle.Add(PageUserActionResult.INFO, info); bundle.Add(PageUserActionResult.KEY_STATUS, status); PageDataExchange context = PageDataExchange.getInstance(); context.putExtra(PageUserActionResult.TAG, bundle); Utils.NavigateToPage(MainWindow.sFrameReportName, PageUserActionResult.TAG, false); }
private void on_BtnClick(object sender, RoutedEventArgs e) { Button btn = sender as Button; String name = btn.GetValue(Button.NameProperty) as String; Dictionary <String, Object> bundle = new Dictionary <string, object>(); bundle.Add(PageDataExchange.KEY_SENDER_NAME, TAG); bundle.Add(PageDataExchange.KEY_SENDER_VALUE, name); if (ACTION_MANUAL.Equals(name) || ACTION_ELECTRIC.Equals(name)) { PageDataExchange sInstance = PageDataExchange.getInstance(); sInstance.putExtra(PageDocument.TAG, bundle); Utils.NavigateToPage(MainWindow.sFrameReportName, PageDocument.TAG); } else if (ACTION_PARAMETER_MODIFY.Equals(name)) { Utils.NavigateToPage(MainWindow.sFrameReportName, PageParameterMain.TAG); } else if (ACTION_PARAMETER_PERSIST.Equals(name)) { Utils.NavigateToPage(MainWindow.sFrameReportName, PageParameterBackup.TAG); } else if (ACTION_USER_MANAGER.Equals(name)) { int userlevel = User.GetInstance().GetCurrentUserInfo().UserLevel; if (userlevel >= User.USER_PREVILIDGE_ADMINISTRATOR) { Utils.NavigateToPage(MainWindow.sFrameReportName, PageUserManager.TAG); } else { MessageBox.Show("您需要管理员用户登录才能进行此操作!"); //bundle.Add(PageUserRegister.USER_PAGE, PageUserRegister.ID_LOGIN); //PageDataExchange.getInstance().putExtra(PageUserRegister.TAG, bundle); //Utils.NavigateToPage(MainWindow.sFrameReportName, PageUserRegister.TAG); } } else if (ACTION_CLEAN_SCREEN.Equals(name)) { PageDataExchange context = PageDataExchange.getInstance(); context.CommandObserver(PageCleanScreen.TAG, PageCleanScreen.TAG, Visibility.Visible); } else { //forward action to MainWindow NotifyObserver(bundle); } }
private void infoPanel_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (this.cb_info.SelectedIndex < 0) { this.cb_info.SelectedIndex = 0; } WarnningDataSource.ErrorInfo info = (WarnningDataSource.ErrorInfo) this.cb_info.SelectedItem; PageDataExchange context = PageDataExchange.getInstance(); if (info.level < 200) { Dictionary <String, Object> bundle = new Dictionary <string, object>(); bundle.Add(PageDataExchange.KEY_SENDER_NAME, WarnningDataSource.TAG); bundle.Add(PageDataExchange.KEY_SENDER_VALUE, info); context.putExtra(PageWarningDetail.TAG, bundle); Utils.NavigateToPage(MainWindow.sFrameReportName, PageWarningDetail.TAG); } context.NotifyObserverChanged(PageWarningDetail.TAG, WarnningDataSource.TAG, info); context.NotifyObserverChanged(PageStatus.TAG, PageStatus.CODE, info.code); }