/// <summary> /// حذف عکس انتخابی /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItem4_Click(object sender, EventArgs e) { try { DialogResult dr = MessageBox.Show("آیا فایل انتخابی حذف شود؟", "تایید", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr != DialogResult.Yes) { return; } int t = folderBrowser.CurrentIndex; string d = @"\Files\" + folderBrowser.GetCurrentFolderName() + @"\PIC"; folderBrowser.CurrentIndex = -3; ImageBrowser.Clear(); try { //عکس کوچک آن هم پاک شود string f = Application.StartupPath + @"\" + this.SelectedImage; FileInfo fi = new FileInfo(f); File.Delete(f); File.Delete(Application.StartupPath + d + @"\thum\" + fi.Name + ".jpg"); //File.Delete(Application.StartupPath + @"\" + d + @"\thum\" + fi.Name + ".jpg"); } catch { } folderBrowser.CurrentIndex = t; } catch { } }
void Start() { ImageBrowser.OnPicked += (image) => { StartCoroutine(LoadTexture(image)); }; ImageBrowser.Pick(); }
private void fpicPictureBox_Click(object sender, EventArgs e) { string imagePath = new ImageBrowser().GetImagePath(); if (!(imagePath.Equals(""))) { fpicPictureBox.ImageLocation = imagePath; } }
public MainWindow(ProgramStatus status, ImageBrowser imageBrowser, SpermogramViewer spermogramaViewer) { InitializeComponent(); this.currentMarker = SpermType.Green; this.status = status; this.imageBrowser = imageBrowser; this.spermogramaViewer = spermogramaViewer; btnGreenMarker.Click += btnGreenMarker_Click; btnRedMarker.Click += btnRedMarker_Click; btnOrangeMarker.Click += btnOrangeMarker_Click; status.AddObserver(text => { this.ChangeStatus(text); }); imageBrowser.Images.OnChange(images => { this.BrowseFiles(images); }); imagesView.AfterSelect += ImagesListView_SelectedIndexChanged; imageBrowser.SelectedImage.OnChange(x => { spermogramaViewer.View(x); }); spermogramaViewer.CurrentSpermogram.OnChange(spermograma => { spermograma.DisplayImage.OnChange(image => { this.UpdateImage(image); }); }); spermogramaViewer.CurrentSpermogram.OnChange(spermograma => { spermograma.Spermatosoids.OnChange((x) => { if (x != null) { this.lblRed.InvokeAsync(lbl => { lbl.Text = x.Count(xx => xx.SpermType == SpermType.Red).ToString(); }); this.lblGreen.InvokeAsync(lbl => { lbl.Text = x.Count(xx => xx.SpermType == SpermType.Green).ToString(); }); this.lblOrange.InvokeAsync(lbl => { lbl.Text = x.Count(xx => xx.SpermType == SpermType.Orange).ToString(); }); } }); }); pictureBox.Click += pictureBox_Click; // imageBrowser.Scan(@"D:\SampleImages"); this.KeyPreview = true; }
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()); } }
void OnGUI() { GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20)); GUI.skin.button.fixedHeight = (Screen.height - 20) / 12; GUI.skin.button.fixedWidth = (Screen.width - 20) / 4; GUI.skin.textArea.fixedHeight = (Screen.height - 20) / 3 - 20 - GUI.skin.button.fixedHeight / 3; GUILayout.BeginHorizontal(); { if (GUILayout.Button("Pick Video")) { VideoBrowser.Pick(); } GUILayout.TextArea(_video); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); { if (GUILayout.Button("Pick Audio")) { AudioBrowser.Pick(); } GUILayout.TextArea(_audio); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); { if (GUILayout.Button("Pick Image")) { ImageBrowser.Pick(); } GUILayout.TextArea(_image); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUI.skin.button.fixedWidth = Screen.width - 20; if (GUILayout.Button("Exit")) { Application.Quit(); } GUILayout.EndArea(); }
private static void ShowOnUI(IAppManager app, string pngFile) { app.RunOnUIThread(() => { //获取秋之盒主窗口 var window = (Window)app.GetMainWindow(); //构建一个HandyControl的图片浏览器 var imgWindow = new ImageBrowser(pngFile); //当主窗口关闭时,关闭图片浏览器窗口 //不使用Window.Owner是为了避免图片窗始终在秋之盒主窗体上层 window.Closing += (s, e) => { imgWindow.Close(); }; //显示浏览器窗口 imgWindow.Show(); }); }
/// <summary> /// اضافه کردن تصویر در پوشه جاری /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItem3_Click(object sender, EventArgs e) { try { DialogResult dr = ofdImages.ShowDialog(); if (dr == DialogResult.Cancel) { return; } int i = ImageBrowser.NextNumber(); foreach (string f in ofdImages.FileNames) { try { string fn = i.ToString("0000000000") + ".jpg"; File.Copy(f, @"Files\" + folderBrowser.GetCurrentFolderName() + @"\PIC\" + fn); Image img = Image.FromFile(f); img = (Image)(new Bitmap(img, new Size(100, 100))); //اضافه بر اضافه کردن تصویر باید عکس کوجک جهت نمایش در صفحه کنترل نیز ساخته شده و ذخیره شود img.Save(@"Files\" + folderBrowser.GetCurrentFolderName() + @"\PIC\thum\" + fn + ".jpg"); i++; } catch { continue; } } } catch { } finally { int t = folderBrowser.CurrentIndex; folderBrowser.CurrentIndex = -3; folderBrowser.CurrentIndex = t; } }
/// <summary> /// حذف پوشه انتخابی /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItem2_Click(object sender, EventArgs e) { try { DialogResult dr = MessageBox.Show("با حذف این پوشه تمام فایل های موجود در آن نیز حذف می شود. آیا پوشه حذف شود؟", "تایید", MessageBoxButtons.YesNo, MessageBoxIcon.Question); int t = folderBrowser.CurrentIndex; string s = folderBrowser.GetCurrentFolderName(); //هیچ پوشه ای انتخاب نباشد تا بتوانیم پوشه را پاک کنیم بدون اینکه ویندوز خطا دهد //هر موقع خواستیم هیچ پوشه ای انتخاب نباشد باید مقدار -3 را به آن بدهیم //folderBrowser.CurrentIndex = -3; if (dr == DialogResult.Yes) { ImageBrowser.Clear(); FilmBrowser.Clear(); folderBrowser.CurrentIndex = -3; DataSet ds = new DataSet(); ds.ReadXml(@"Files\Folders.xml"); ds.Tables[0].Rows.RemoveAt(t); ds.WriteXml(@"Files\Folders.xml"); folderBrowser.init(); folderBrowser.GoToFolder(1); Directory.Delete(@"Files\" + s, true); } } catch (Exception ex) { } }
void OnGUI() { GUILayout.BeginArea(new Rect(10, 10, Screen.width - 20, Screen.height - 20)); GUI.skin.button.fixedHeight = (Screen.height - 20) / 10; GUI.skin.button.fixedWidth = (Screen.width - 20) / 3 - 3; GUI.skin.textField.fixedWidth = (Screen.width - 20); GUI.skin.textField.fixedHeight = (Screen.width - 20) / 12; GUI.skin.textArea.fixedHeight = (Screen.height - 20) / 3 - 20 - GUI.skin.button.fixedHeight / 3; GUILayout.Label("Title:"); titleQuery = GUILayout.TextField(titleQuery); GUILayout.BeginHorizontal(); { if (GUILayout.Button("Query Audio")) { var audios = AudioBrowser.QueryLibrary("", "", titleQuery); if (audios == null) { result = "Audio query failed"; } else { result = "Audio query results count: " + audios.Length; foreach (var audio in audios) { result += "\n " + audio.Artist + " - " + audio.Title; StartCoroutine(audio.LoadAudioClip(false, false, AudioType.WAV, (clip) => audioSource.clip = clip)); } } } if (GUILayout.Button("Query Video")) { var videos = VideoBrowser.QueryLibrary(titleQuery); if (videos == null) { result = "Video query failed"; } else { result = "Video query results count: " + videos.Length; foreach (var video in videos) { result += "\n " + video.Title; } } } if (GUILayout.Button("Query Image")) { var images = ImageBrowser.QueryLibrary(titleQuery); if (images == null) { result = "Image query failed"; } else { result = "Image query results count: " + images.Length; foreach (var image in images) { result += "\n " + image.Title; } } } } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.Label("Result:"); GUILayout.TextArea(result); GUILayout.Space(20); GUI.skin.button.fixedWidth = Screen.width - 20; if (GUILayout.Button("Exit")) { Application.Quit(); } GUILayout.EndArea(); }