⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 photoexistsdialog.cs

📁 这是一个小型的相片管理器
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using VirtualPhotoOrganizer.Util;
using TXML;

namespace VirtualPhotoOrganizer.Dialogs
{
	/// <summary>
	/// dialog displayed if a file that is supposed to be added to an album already exists
	/// DialogResult.Yes: Overwrite the existing file
	/// DialogResult.No: Skip this file
	/// DialogResult.Rename: Rename this file so that it can be added to the album
	/// </summary>
	internal class PhotoExistsDialog : System.Windows.Forms.Form
	{
		// the update use this event
		public delegate void UseThisChecked(bool isChecked);
		public event UseThisChecked CheckedUseThis;

		// needed for playing the beep message
		[System.Runtime.InteropServices.DllImport("user32.dll")]
		public static extern bool MessageBeep(uint beepType);

		private System.Windows.Forms.Button bOverwrite;
		private System.Windows.Forms.Button bRename;
		private System.Windows.Forms.Button bSkip;
		private System.Windows.Forms.CheckBox cbUseThis;
		private System.Windows.Forms.Label lbMain;
		/// <summary>
		/// Erforderliche Designervariable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public PhotoExistsDialog() {
			//
			// Erforderlich f黵 die Windows Form-Designerunterst黷zung
			//
			InitializeComponent();

			LoadStrings();
		}

		/// <summary>
		/// Die verwendeten Ressourcen bereinigen.
		/// </summary>
		protected override void Dispose(bool disposing) {
			if (disposing) {
				if (components != null) {
					components.Dispose();
				}
			}
			base.Dispose(disposing);
		}

		private void LoadStrings() {
			const string MN = "PhotoExistsDialog";
			string lsMain;
			string lsOverwrite;
			string lsSkip;
			string lsRename;
			string lsUseThis;

			try {
				TXmlReader reader = XmlHandler.OpenLangFile();

				lsMain = reader.GetString(MN, "Main", "The above photo already exists in the album. - Do you wish to overwrite the existing file, skip this photo, or rename it so that it can be added to the album?");
				lsOverwrite = reader.GetString(MN, "Overwrite", "&Overwrite");
				lsSkip = reader.GetString(MN, "Skip", "&Skip");
				lsRename = reader.GetString(MN, "Rename", "&Rename");
				lsUseThis = reader.GetString(MN, "UseThis", "Use this action for the entire operation");

				reader.Close();
			}
			catch {
				lsMain = "The above photo already exists in the album. - Do you wish to overwrite the existing file, skip this photo, or rename it so that it can be added to the album?";
				lsOverwrite = "&Overwrite";
				lsSkip = "&Skip";
				lsRename = "&Rename";
				lsUseThis = "Use this action for the entire operation";
			}

			lbMain.Text = lsMain;
			bOverwrite.Text = lsOverwrite;
			bSkip.Text = lsSkip;
			bRename.Text = lsRename;
			cbUseThis.Text = lsUseThis;
		}

		public string PhotoPath {
			set { this.Text = value; }
		}

		#region Vom Windows Form-Designer generierter Code
		/// <summary>
		/// Erforderliche Methode f黵 die Designerunterst黷zung. 
		/// Der Inhalt der Methode darf nicht mit dem Code-Editor ge鋘dert werden.
		/// </summary>
		private void InitializeComponent() {
			this.bOverwrite = new System.Windows.Forms.Button();
			this.bRename = new System.Windows.Forms.Button();
			this.bSkip = new System.Windows.Forms.Button();
			this.cbUseThis = new System.Windows.Forms.CheckBox();
			this.lbMain = new System.Windows.Forms.Label();
			this.SuspendLayout();
			// 
			// bOverwrite
			// 
			this.bOverwrite.DialogResult = System.Windows.Forms.DialogResult.Yes;
			this.bOverwrite.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.bOverwrite.Location = new System.Drawing.Point(88, 80);
			this.bOverwrite.Name = "bOverwrite";
			this.bOverwrite.Size = new System.Drawing.Size(88, 23);
			this.bOverwrite.TabIndex = 0;
			this.bOverwrite.Text = "&Overwrite";
			// 
			// bRename
			// 
			this.bRename.DialogResult = System.Windows.Forms.DialogResult.Retry;
			this.bRename.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.bRename.Location = new System.Drawing.Point(296, 80);
			this.bRename.Name = "bRename";
			this.bRename.Size = new System.Drawing.Size(88, 23);
			this.bRename.TabIndex = 1;
			this.bRename.Text = "&Rename";
			// 
			// bSkip
			// 
			this.bSkip.DialogResult = System.Windows.Forms.DialogResult.No;
			this.bSkip.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.bSkip.Location = new System.Drawing.Point(192, 80);
			this.bSkip.Name = "bSkip";
			this.bSkip.Size = new System.Drawing.Size(88, 23);
			this.bSkip.TabIndex = 2;
			this.bSkip.Text = "&Skip";
			// 
			// cbUseThis
			// 
			this.cbUseThis.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.cbUseThis.Location = new System.Drawing.Point(24, 112);
			this.cbUseThis.Name = "cbUseThis";
			this.cbUseThis.Size = new System.Drawing.Size(424, 24);
			this.cbUseThis.TabIndex = 3;
			this.cbUseThis.Text = "Use this action for the entire operation";
			this.cbUseThis.CheckedChanged += new System.EventHandler(this.cbUseThis_CheckedChanged);
			// 
			// lbMain
			// 
			this.lbMain.Location = new System.Drawing.Point(16, 16);
			this.lbMain.Name = "lbMain";
			this.lbMain.Size = new System.Drawing.Size(432, 56);
			this.lbMain.TabIndex = 4;
			this.lbMain.Text = "The above photo already exists in the album. - Do you wish to overwrite the exist" +
				"ing file, skip this photo, or rename it so that it can be added to the album?";
			// 
			// PhotoExistsDialog
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(464, 142);
			this.ControlBox = false;
			this.Controls.Add(this.lbMain);
			this.Controls.Add(this.cbUseThis);
			this.Controls.Add(this.bSkip);
			this.Controls.Add(this.bRename);
			this.Controls.Add(this.bOverwrite);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "PhotoExistsDialog";
			this.Text = "PhotoExistsDialog";
			this.Load += new System.EventHandler(this.PhotoExistsDialog_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void cbUseThis_CheckedChanged(object sender, System.EventArgs e) {
			CheckedUseThis(cbUseThis.Checked);
		}

		private void PhotoExistsDialog_Load(object sender, System.EventArgs e) {
			MessageBeep(0x00000030);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -