public void ShowNoDataNotification(string Type) { var navigationService = NavigationServiceProvider.GetNavigationServiceInstance(); var builder = this.Manager .CreateMessage() .Accent(AppVariable.RED) .Background(AppVariable.BGBLACK) .HasBadge("هشدار") .HasMessage("اطلاعاتی در پایگاه داده یافت نشد") .Dismiss().WithButton("ثبت اطلاعات جدید", button => { switch (Type) { case "School": AddSchoolView.main.tabc.SelectedIndex = 0; break; case "User": AddUserView.main.tabc.SelectedIndex = 0; break; case "Student": AddStudentView.main.tabc.SelectedIndex = 0; break; case "Attendance": AttendancelistView.main.tabc.SelectedIndex = 0; break; case "Question": navigationService.GetController <UserControls.UserControlsController>().AddStudent(); break; case "Score": QuestionsListView.main.tabc.SelectedIndex = 0; break; case "TopStudent": navigationService.GetController <UserControls.UserControlsController>().Questionslist(); break; case "Group": AddAzmonGroupView.main.tabc.SelectedIndex = 0; break; case "AQuestions": AddQuestionsView.main.tabc.SelectedIndex = 0; break; } }) .Dismiss().WithButton("بیخیال", button => { }) .Animates(true) .AnimationInDuration(AppVariable.NotificationAnimInDur) .AnimationOutDuration(AppVariable.NotificationAnimOutDur) .Dismiss().WithDelay(TimeSpan.FromSeconds(AppVariable.NotificationDelay)); builder.Queue(); }
private void NavigationMenuItem_Click(object sender, EventArgs e) { var navigationService = NavigationServiceProvider.GetNavigationServiceInstance(); var selectedItem = sender as MetroExpander; switch (selectedItem.Tag) { case "initial": navigationService.GetController <UserControls.UserControlsController>().Initial(); break; case "addOrUpdateSchool": navigationService.GetController <UserControls.UserControlsController>().AddSchool(); break; case "exAddOrUpdateStudent": navigationService.GetController <UserControls.UserControlsController>().AddStudent(); break; case "exAddOrUpdateUser": navigationService.GetController <UserControls.UserControlsController>().AddUser(); break; case "exAttendancelist": navigationService.GetController <UserControls.UserControlsController>().Attendancelist(); break; case "exQuestionsList": navigationService.GetController <UserControls.UserControlsController>().Questionslist(); break; case "exTopStudents": navigationService.GetController <UserControls.UserControlsController>().TopStudents(); break; case "exAchievement": navigationService.GetController <UserControls.UserControlsController>().Achievement(); break; case "exCircular": navigationService.GetController <UserControls.UserControlsController>().Circular(); break; case "exBook": navigationService.GetController <UserControls.UserControlsController>().Books(); break; case "exRoshd": navigationService.GetController <UserControls.UserControlsController>().Magazine(); break; } }
private void ListBoxItem_Selected(object sender, RoutedEventArgs e) { var navigationService = NavigationServiceProvider.GetNavigationServiceInstance(); var selectedItem = sender as ListBoxItem; switch (selectedItem.Tag) { case "initial": navigationService.GetController <UserControls.UserControlsController>().Initial(); break; case "addOrUpdateSchool": navigationService.GetController <UserControls.UserControlsController>().AddSchool(); break; case "exAddOrUpdateStudent": navigationService.GetController <UserControls.UserControlsController>().AddStudent(); break; case "exAddOrUpdateUser": navigationService.GetController <UserControls.UserControlsController>().AddUser(); break; case "exAttendancelist": navigationService.GetController <UserControls.UserControlsController>().Attendancelist(); break; case "exQuestionsList": navigationService.GetController <UserControls.UserControlsController>().Questionslist(); break; case "exTopStudents": navigationService.GetController <UserControls.UserControlsController>().TopStudents(); break; case "exAchievement": navigationService.GetController <UserControls.UserControlsController>().Achievement(); break; case "exCircular": navigationService.GetController <UserControls.UserControlsController>().Circular(); break; } }
public void showGrowlNotification(string NotificationKEY, bool isAvailableOrSuccess = false, params string[] param) { //Delete Confirm if (NotificationKEY.Equals(AppVariable.Delete_Confirm_KEY)) { Growl.Warning(new GrowlInfo { Message = $"آیا برای حذف {param[1]} {param[0]} اطمینان دارید؟", CancelStr = "انصراف", ConfirmStr = "بله", ShowDateTime = false, ActionBeforeClose = isConfirm => { if (isConfirm) { switch (param[1]) { case "مدرسه": AddSchoolView.main.deleteSchool(); break; case "دانش آموز": AddStudentView.main.deleteStudent(); break; case "کاربر": AddUserView.main.deleteUser(); break; case "حضورغیاب": AttendancelistView.main.deleteAttendance(); break; case "نمره": QuestionsListView.main.deleteScore(); break; case "گروه": AddAzmonGroupView.main.deleteGroup(); break; case "سوال": AddQuestionsView.main.deleteGroup(); break; } } return(true); } }); } //Reset Data Confirm else if (NotificationKEY.Equals(AppVariable.Reset_Data_Confirm_KEY)) { Growl.Warning(new GrowlInfo { Message = $"آیا برای بازیابی {param[0]} اطمینان دارید؟", CancelStr = "انصراف", ConfirmStr = "بله", ShowDateTime = false, ActionBeforeClose = isConfirm => { if (isConfirm) { if (param[0] == "تنظیمات برنامه") { SettingsView.main.resetConfig(); } else { SettingsView.main.resetDatabase(); } } return(true); } }); } //Reset Data Deleted else if (NotificationKEY.Equals(AppVariable.Data_Reset_Deleted_KEY)) { Growl.Ask(new GrowlInfo { Message = $"{param[0]} به حالت پیشفرض تغییر یافت، برنامه را دوباره راه اندازی کنید", CancelStr = "انصراف", ConfirmStr = "راه اندازی", ShowDateTime = false, ActionBeforeClose = isConfirm => { if (isConfirm) { Application.Current.Shutdown(); System.Windows.Forms.Application.Restart(); } return(true); } }); } //Password Same else if (NotificationKEY.Equals(AppVariable.Same_Password_KEY)) { Growl.Warning(new GrowlInfo { Message = "رمز های عبور باید یکسان باشند", ShowDateTime = false }); } //Delete Exist else if (NotificationKEY.Equals(AppVariable.Delete_Exist_KEY)) { Growl.Warning(new GrowlInfo { Message = $"نمی توان این {param[0]} را حذف کرد، ابتدا {param[1]} این {param[0]} را حذف کنید", ShowDateTime = false }); } //Azmon else if (NotificationKEY.Equals(AppVariable.Azmon_KEY)) { Growl.Warning(new GrowlInfo { Message = "تعداد سوالات وارد شده بیشتر از سوالات موجود است", ShowDateTime = false }); } //Fill All Data else if (NotificationKEY.Equals(AppVariable.Fill_All_Data_KEY)) { Growl.Warning(new GrowlInfo { Message = "لطفا تمام فیلدها را پر کنید", ShowDateTime = false }); } //No Data else if (NotificationKEY.Equals(AppVariable.No_Data_KEY)) { var navigationService = NavigationServiceProvider.GetNavigationServiceInstance(); Growl.Error(new GrowlInfo { Message = "اطلاعاتی در پایگاه داده یافت نشد", CancelStr = "انصراف", ConfirmStr = "ثبت اطلاعات جدید", ShowDateTime = false, ActionBeforeClose = isConfirm => { if (isConfirm) { switch (param[0]) { case "School": AddSchoolView.main.tabc.SelectedIndex = 0; break; case "User": AddUserView.main.tabc.SelectedIndex = 0; break; case "Student": AddStudentView.main.tabc.SelectedIndex = 0; break; case "Attendance": AttendancelistView.main.tabc.SelectedIndex = 0; break; case "Question": navigationService.GetController <UserControls.UserControlsController>().AddStudent(); break; case "Score": QuestionsListView.main.tabc.SelectedIndex = 0; break; case "TopStudent": navigationService.GetController <UserControls.UserControlsController>().Questionslist(); break; case "Group": AddAzmonGroupView.main.tabc.SelectedIndex = 0; break; case "AQuestions": AddQuestionsView.main.tabc.SelectedIndex = 0; break; } } return(true); } }); } //Backup else if (NotificationKEY.Equals(AppVariable.Backup_KEY)) { if (isAvailableOrSuccess) { Growl.Success(new GrowlInfo { Message = $"{param[0]} با موفقیت انجام شد", ShowDateTime = false }); } else { Growl.Error(new GrowlInfo { Message = $"{param[0]} با مشکل مواجه شد", ShowDateTime = false }); } } //Circular else if (NotificationKEY.Equals(AppVariable.Recived_Circular_KEY)) { if (isAvailableOrSuccess) { Growl.Success(new GrowlInfo { Message = "تمامی بخشنامه ها با موفقیت دریافت شد", ShowDateTime = false }); } else { Growl.Error(new GrowlInfo { Message = "درحال حاظر سرور در دسترس نیست! لطفا در صورت فعال بودن، VPN خود را غیرفعال کنید", ShowDateTime = false }); } } //Update Data else if (NotificationKEY.Equals(AppVariable.Update_Data_KEY)) { if (isAvailableOrSuccess) { Growl.Success(new GrowlInfo { Message = $"{param[1]} {param[0]} با موفقیت ویرایش شد", ShowDateTime = false }); } else { Growl.Error(new GrowlInfo { Message = $"ویرایش {param[1]} {param[0]} با خطا مواجه شد", ShowDateTime = false }); } } //Deleted else if (NotificationKEY.Equals(AppVariable.Deleted_KEY)) { if (isAvailableOrSuccess) { Growl.Success(new GrowlInfo { Message = $"{param[1]} {param[0]} با موفقیت حذف شد", ShowDateTime = false }); } else { Growl.Error(new GrowlInfo { Message = $"حذف {param[1]} {param[0]} با خطا مواجه شد", ShowDateTime = false }); } } //Add Data else if (NotificationKEY.Equals(AppVariable.Add_Data_KEY)) { if (isAvailableOrSuccess) { Growl.Success(new GrowlInfo { Message = $"{param[1]} {param[0]} با موفقیت ثبت شد", ShowDateTime = false }); } else { Growl.Error(new GrowlInfo { Message = $"ثبت {param[1]} {param[0]} با خطا مواجه شد", ShowDateTime = false }); } } //Update else if (NotificationKEY.Equals(AppVariable.Update_KEY)) { if (isAvailableOrSuccess) { Growl.Info(new GrowlInfo { Message = $"نسخه جدید {param[0]} پیدا شد،همین حالا به آخرین نسخه بروزرسانی کنید", CancelStr = "انصراف", ConfirmStr = "دانلود", ShowDateTime = false, ActionBeforeClose = isConfirm => { if (isConfirm) { System.Diagnostics.Process.Start(param[1]); } return(true); } }); } else { Growl.Error(new GrowlInfo { Message = $"شما از آخرین نسخه {AppVariable.getAppVersion} استفاده می کنید", ShowDateTime = false }); } } }