private void PinBox_OnCompleted(object sender, RoutedEventArgs e) { if (e.OriginalSource is PinBox pinBox) { Growl.Info(pinBox.Password); } }
private void CompareVersions() { if (IsVersionLater(newVersion, getAppVersion)) { Growl.Info(new GrowlInfo { Message = $"A new version {newVersion} has been detected!Do you want to update?", ShowDateTime = false, ActionBeforeClose = isConfirm => { if (isConfirm) { Process.Start(url); } return(true); }, CancelStr = "Cancel", ConfirmStr = "Confirm" }); Growl.Info(ChangeLog); } else { Growl.Error($"You are using latest version {getAppVersion}"); } }
private void showGrowlNotification(bool isSuccess, params string[] param) { if (isSuccess) { Growl.Info(new GrowlInfo { Message = string.Format(Properties.Langs.Lang.NewVersionFind, param[0]) + Environment.NewLine + ChangeLog, CancelStr = Properties.Langs.Lang.Cancel, ConfirmStr = Properties.Langs.Lang.Download, ShowDateTime = false, ActionBeforeClose = isConfirm => { if (isConfirm) { System.Diagnostics.Process.Start(param[1]); } return(true); } }); } else { Growl.Error(new GrowlInfo { Message = string.Format(Properties.Langs.Lang.CurrentIsLastVersion, Assembly.GetExecutingAssembly().GetName().Version.ToString()), ShowDateTime = false }); } }
private void CopyButton_Click(object sender, RoutedEventArgs e) { var clipboardThread = new Thread(ClipboardThread); clipboardThread.SetApartmentState(ApartmentState.STA); clipboardThread.IsBackground = false; clipboardThread.Start(); Growl.Info("源代码已复制到剪贴板,请打开邮箱进行粘贴。", "MainMessage"); }
private void Button_Help(object sender, RoutedEventArgs e) { Growl.Info(new GrowlInfo { Message = "Step 1: Create Txt File like this(each line one Link):\n http://Test.com\nhttp://Test.com\nStep 2: Load txt File\nStep 3: Choose Url Shorten Service\nStep 4: Select urls\nStep 5: Click Start", ShowDateTime = false }); }
private void CancelTaskButton_Click(object sender, RoutedEventArgs e) { ts?.Cancel(); Growl.Info(new GrowlInfo { Message = Properties.Langs.Lang.TaskCanceled, ShowDateTime = false, ShowCloseButton = false }); }
public void showNotification(bool isError, string Message) { if (isError) { Growl.Error(Message); } else { Growl.Info(Message); } }
public async void Info(string msg) { await WaitForTokenLoaded(); if (Thread.CurrentThread != App.Current.Dispatcher.Thread) { App.Current.Dispatcher.Invoke(() => { Growl.Info(msg, Token); }); } }
private void CoverContextMenu_Click(object sender, RoutedEventArgs e) { MenuItem info = sender as MenuItem; if (info.Header.Equals(Properties.Langs.Lang.SetasDesktop)) { SetDesktopWallpaper(info.Tag.ToString(), true); } else if (info.Header.Equals(Properties.Langs.Lang.GoToLoc)) { System.Diagnostics.Process.Start("explorer.exe", "/select, \"" + info.Tag + "\""); } else if (info.Header.Equals(Properties.Langs.Lang.FullScreenSee)) { ImageBrowser imgBrowser = new ImageBrowser(new Uri(info.Tag.ToString(), UriKind.Absolute)) { ResizeMode = ResizeMode.CanResize }; imgBrowser.Show(); } else if (info.Header.Equals(Properties.Langs.Lang.Fav)) { if (System.IO.File.Exists(AppVar.FavoriteFilePath)) { bool lines = System.IO.File.ReadAllLines(AppVar.FavoriteFilePath).Any(x => x.Equals(info.Tag.ToString().Trim())); if (!lines) { System.IO.File.AppendAllText(AppVar.FavoriteFilePath, info.Tag.ToString().Trim() + Environment.NewLine); Growl.Info(new GrowlInfo { Message = Properties.Langs.Lang.AddedToFav, ConfirmStr = Properties.Langs.Lang.Confirm, ShowDateTime = false }); } else { Growl.Warning(new GrowlInfo { Message = Properties.Langs.Lang.ExistFav, ConfirmStr = Properties.Langs.Lang.Confirm, ShowDateTime = false }); } } } else if (info.Header.Equals(Properties.Langs.Lang.RemoveFromFav)) { List <string> lines = System.IO.File.ReadAllLines(AppVar.FavoriteFilePath).ToList(); lines.Remove(info.Tag.ToString().Trim()); System.IO.File.WriteAllLines(AppVar.FavoriteFilePath, lines.ToArray()); } }
private void MenuItem_Click(object sender, RoutedEventArgs e) { var info = sender as MenuItem; if (info.Header.Equals("Set as Desktop")) { SetDesktopWallpaper(info.Tag.ToString(), true); } else if (info.Header.Equals("Go to Location")) { Process.Start("explorer.exe", "/select, \"" + info.Tag + "\""); } else if (info.Header.Equals("Full Screen")) { var imgBrowser = new ImageBrowser(new Uri(info.Tag.ToString(), UriKind.Absolute)); imgBrowser.ResizeMode = ResizeMode.CanResize; imgBrowser.Show(); } else if (info.Header.Equals("Add To Favorite")) { if (File.Exists("fav.txt")) { var lines = File.ReadAllLines("fav.txt").Any(x => x.Equals(info.Tag.ToString().Trim())); if (!lines) { File.AppendAllText("fav.txt", info.Tag.ToString().Trim() + Environment.NewLine); Growl.Info(new GrowlInfo { Message = "Added to Favorite", ConfirmStr = "Confirm", ShowDateTime = false }); } else { Growl.Warning(new GrowlInfo { Message = "This image exist in favorite", ConfirmStr = "Confirm", ShowDateTime = false }); } } } else if (info.Header.Equals("Remove From Favorite")) { var lines = File.ReadAllLines("fav.txt").ToList(); lines.Remove(info.Tag.ToString().Trim()); File.WriteAllLines("fav.txt", lines.ToArray()); } }
public async void Info(string msg) { await WaitForTokenLoaded(); App.Current.Dispatcher.Invoke(() => { if (Program.CliOptions.GlobalNotification) { Growl.InfoGlobal(msg); } else { Growl.Info(msg, Token); } }); }
private static void ShowNotificationInApp(string message, ENotificationType type) { Action action = type switch { ENotificationType.Success => () => Growl.Success(message), ENotificationType.Info => () => Growl.Info(message), ENotificationType.Warning => () => Growl.Warning(message), ENotificationType.Error => () => Growl.Error(message), ENotificationType.Fatal => () => Growl.Fatal(message), _ => throw new ArgumentOutOfRangeException(nameof(type), type, null) }; Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, action); } #endregion }
/// <summary> /// 壁纸列表数据加载完成事件 /// </summary> /// <param name="total">壁纸列表</param> /// <param name="msg">返回的消息</param> private void ImageList_OnComplate(ImageListTotal total, string msg) { if (total != null && total.data.Count > 0) { var list = total.data; foreach (var picInfo in list) { Image img = new Image(); img.Tag = PageType.MPA; img.Height = imgSize.Height; img.Width = imgSize.Width; img.Margin = margin; img.MouseDown += Image_MouseDown; Grid grid = new Grid(); grid.Children.Add(new LoadingCircle()); grid.Children.Add(img); downQueue.Queue(img, picInfo, picInfo.GetUrlBySize((int)img.Width, (int)img.Height)); grid.MouseEnter += Grid_MouseEnter; grid.MouseLeave += Grid_MouseLeave; panel.Children.Add(grid); grid.Tag = this.picIndex; picInfo.Index = this.picIndex++; } if (curImageListTotal == null) { curImageListTotal = total; } else { curImageListTotal.data.AddRange(list); } } else if (!string.IsNullOrEmpty(msg)) { Growl.Info(msg); } zoomImage.Source = null; // 如果当前是单页显示模式,则需要加载新的壁纸类型的第一张壁纸 if (this.Content is Grid pGrid && pGrid.Name == "zoomGrid") { if (curImageListTotal != null && curImageListTotal.data.Count > 0) { this.ShowBigPic(curImageListTotal.data[0]); } } }
private void MenuItem_Click(object sender, RoutedEventArgs e) { MenuItem tag = sender as MenuItem; switch (tag.Tag) { case "Update": CheckUpdate(); break; case "About": Growl.Info(new GrowlInfo { Message = "Coded by Mahdi Hosseini\n Contact: [email protected]", ShowDateTime = false }); break; } }
/// <summary> /// 下一组图片 /// </summary> public void NextImages() { if (curImageListTotal == null || this.picIndex < curImageListTotal.total) { ImageListTotal total = null; if (string.IsNullOrEmpty(keyWord)) { total = ImageHelper.GetImageListTotal(this.picType, this.picIndex, 24); } else { total = WebImage.GetImageListByKW(keyWord, this.picIndex, 24); } string msg = string.Empty; if (total.total == 0) { switch (this.picType) { case "wall": msg = "您还没有设置过壁纸"; break; // 设置壁纸 case "love": msg = "您还没有收藏过壁纸"; break; // 收藏的 case "down": msg = "您还没有下载过壁纸"; break; //下载的 default: if (!string.IsNullOrEmpty(keyWord)) //搜索 { msg = $"未搜索到与【{keyWord}】相关的壁纸"; } break; } } this.Dispatcher.BeginInvoke(this.OnComplate, new Object[] { total, msg }); } else if (curImageListTotal != null && this.picIndex >= curImageListTotal.total) { Growl.Info($"已经滑到底了,总共{curImageListTotal.total}张壁纸"); } }
/// <summary> /// 鼠标滑轮滚动事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ZoomGrid_MouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e) { try { ImgInfo imgInfo = null; // 滚轮向上 if (e.Delta > 0) { imgInfo = this.GetimgInfo(zoomGrid.Tag, -1); } // 滚轮向下 else { imgInfo = this.GetimgInfo(zoomGrid.Tag, 1); } this.ShowBigPic(imgInfo); } catch (Exception ex) { Growl.Info(ex.Message); } }
private void SName_SearchStarted(object sender, FunctionEventArgs <string> e) { string name = SName.Text; if (string.IsNullOrEmpty(name) || name == "") { Growl.Warning(new GrowlInfo { Message = "请输入内容", WaitTime = 3, ActionBeforeClose = isConfirmed => { Growl.Info(isConfirmed.ToString()); return(true); }, Token = "SuccessMsg" }); return; } d = Dialog.Show <ProgressDialog>(); new Task(() => { Red(name); }).Start(); }
public MyCourseViewModel() { var mycourseresult = WebHelper.Get(BaseConfig.Host + "/myCourses.asp").Html; var matchsname = Regex.Matches(mycourseresult, regexName); var matchsbutton = Regex.Matches(mycourseresult, regexButton); for (int a = 0; a < matchsbutton.Count; a++) { string sprogress = TextHelper.Between(matchsbutton[a].Groups[2].Value, "(", "%"); MyCourseList.Add(new MyCourseModel { IndexPhoto = matchsname[a].Groups[2].Value, CourseName = matchsname[a].Groups[3].Value, CourseUrl = matchsbutton[a].Groups[1].Value, Progress = Convert.ToDecimal(sprogress) }); } OnPropertyChanged(nameof(MyCourseList)); if (MyCourseList.Count <= 0) { Growl.Info("没有找到课程!"); } }
internal static void SettingsReset() => Growl.Info(GetGrowlInfo("Settings Reset! Make sure to save your settings!"));
internal static void SettingsSaved() => Growl.Info(GetGrowlInfo("Settings Saved!"));
private void Search(string key) { Growl.Info(key, "InfoMessage"); }
private void Closed(RoutedEventArgs args) { Growl.Info($"{(args.OriginalSource as TabItem)?.Header} Closed"); }
private void Search(string key) { Growl.Info(key); }
public MainWindow(MainWindowViewModel viewModel) { InitializeComponent(); ViewModel = viewModel; growlToken = GrowlStackPanel.Name; Growl.Register(growlToken, GrowlStackPanel); this.WhenActivated(disposableRegistration => { this.OneWayBind(ViewModel, vm => vm.AccountAuthorityLevel, v => v.LoginSideMenu.Visibility, value => value == AuthorityLevel.Visitor ? Visibility.Visible : Visibility.Collapsed) .DisposeWith(disposableRegistration); this.OneWayBind(ViewModel, vm => vm.AccountAuthorityLevel, v => v.RegisterSideMenu.Visibility, value => value == AuthorityLevel.Visitor ? Visibility.Visible : Visibility.Collapsed) .DisposeWith(disposableRegistration); this.OneWayBind(ViewModel, vm => vm.AccountAuthorityLevel, v => v.BorrowLogSideMenu.Visibility, value => value >= AuthorityLevel.Member ? Visibility.Visible : Visibility.Collapsed) .DisposeWith(disposableRegistration); this.OneWayBind(ViewModel, vm => vm.AccountAuthorityLevel, v => v.AccountInfoSideMenu.Visibility, value => value >= AuthorityLevel.Member ? Visibility.Visible : Visibility.Collapsed) .DisposeWith(disposableRegistration); this.OneWayBind(ViewModel, vm => vm.AccountAuthorityLevel, v => v.BooksSideMenu.Visibility, value => value >= AuthorityLevel.Member ? Visibility.Visible : Visibility.Collapsed) .DisposeWith(disposableRegistration); Observable.FromEventPattern(MainSideMenu, nameof(MainSideMenu.SelectionChanged)) .Select(ep => (ep.EventArgs as FunctionEventArgs <object>)?.Info as SideMenuItem) .Where(smi => smi != null) .Subscribe(smi => Navigate(smi.Name)) .DisposeWith(disposableRegistration); Observable.FromEventPattern(AboutMenuItem, nameof(AboutMenuItem.Click)) .Subscribe(ep => aboutWindow.Show()) .DisposeWith(disposableRegistration); foreach (SideMenuItem smi in MainSideMenu.Items.OfType <SideMenuItem>().SelectMany(smi => smi.Items).OfType <SideMenuItem>()) { sideMenuItems.Add(smi.Name, smi); } // 注册右上角漂浮通知 ViewModel.GUINotify.RegisterHandler(async interactioni => { await Task.Run(() => { GUINotifyingDataPackage info = interactioni.Input; interactioni.SetOutput(Unit.Default); GrowlInfo growlInfo = new GrowlInfo { Message = info.Message, WaitTime = (int)info.Duration.TotalSeconds, Token = growlToken, StaysOpen = false, IsCustom = true }; switch (info.Type) { case NotifyingType.Success: growlInfo.WaitTime = growlInfo.WaitTime == 0 ? 4 : growlInfo.WaitTime; Growl.Success(growlInfo); break; default: case NotifyingType.Info: growlInfo.WaitTime = growlInfo.WaitTime == 0 ? 4 : growlInfo.WaitTime; Growl.Info(growlInfo); break; case NotifyingType.Warning: growlInfo.WaitTime = growlInfo.WaitTime == 0 ? 6 : growlInfo.WaitTime; Growl.Warning(growlInfo); break; case NotifyingType.Error: growlInfo.WaitTime = growlInfo.WaitTime == 0 ? 8 : growlInfo.WaitTime; Growl.Error(growlInfo); break; case NotifyingType.Fatal: growlInfo.WaitTime = growlInfo.WaitTime == 0 ? 10 : growlInfo.WaitTime; Growl.Fatal(growlInfo); break; } }); }); }); }
public static List <LocpackData> ReadAllLocpack() { /*return await Task.Run(() => { * * });*/ List <LocpackData> list = new List <LocpackData>(); string path = Properties.Settings.Default.FileLocation; if (path == null || path == string.Empty) { Growl.Warning("未指定Localizer汉化包存放位置."); return(list); } var files = Directory.GetFiles(path, "*.locpack"); if (files.Any()) { foreach (var filename in files) { try //开始读取单个文件 { var jsons = new Dictionary <string, JObject>(); var zip = ZipFile.Read(filename); if (!zip.ContainsEntry("Package.json")) { Growl.Info($"未在文件 {filename} 中找到 Package.json, 文件可能损坏或非Localizer汉化包."); continue; } var json = JObject.Parse(new StreamReader(zip["Package.json"].OpenReader()).ReadToEnd()); jsons.Add("Package", json); var locpackdata = new LocpackData(json); long count = 0; foreach (string zipfile in json["FileList"].ToArray()) { try { if (zip.ContainsEntry(zipfile + ".json")) { var tempjson = JObject.Parse(new StreamReader(zip[zipfile + ".json"].OpenReader()).ReadToEnd()); jsons.Add(zipfile, tempjson); switch (zipfile) { case "Package": break; case "LdstrFile": foreach (var ldstrentries in tempjson["LdstrEntries"].Children()) { count += ldstrentries.Children().Count(); } break; default: count += tempjson.Count; break; } } } catch (Exception zipex) { Growl.Error(zipex.Message); } } locpackdata.EntriesCount = count; locpackdata.Data = jsons; list.Add(locpackdata); } catch (Exception ex) { Growl.Error(ex.Message); } } } return(list); }
private void SwitchItem(FunctionEventArgs <object> info) => Growl.Info((info.Info as SideMenuItem)?.Header.ToString());
public static void Info(string message) { Growl.Info(App.Current.Resources[message]?.ToString() ?? message, TOKEN_PANEL_MAIN); }
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 }); } } }