• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MessageBoxForm类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MessageBoxForm的典型用法代码示例。如果您正苦于以下问题:C# MessageBoxForm类的具体用法?C# MessageBoxForm怎么用?C# MessageBoxForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MessageBoxForm类属于命名空间,在下文中一共展示了MessageBoxForm类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: buttonOK_Click

		private void buttonOK_Click(object sender, EventArgs e)
		{
			if (dateStart.Value > dateStop.Value)
			{
				//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
				MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
				var messageBox = new MessageBoxForm("The end date of a show must fall after the start date.", "Date Error", false, true);
				messageBox.ShowDialog();
				return;
			}
			_scheduleItem.StartDate = dateStart.Value;
			_scheduleItem.EndDate = dateStop.Value;
			_scheduleItem.Sunday = checkSunday.Checked;
			_scheduleItem.Monday = checkMonday.Checked;
			_scheduleItem.Tuesday = checkTuesday.Checked;
			_scheduleItem.Wednesday = checkWednesday.Checked;
			_scheduleItem.Thursday = checkThursday.Checked;
			_scheduleItem.Friday = checkFriday.Checked;
			_scheduleItem.Saturday = checkSaturday.Checked;
			_scheduleItem.StartTime = dateStartTime.Value;
			_scheduleItem.EndTime = dateEndTime.Value;
			_scheduleItem.Enabled = checkEnabled.Checked;

			if (comboBoxShow.SelectedIndex >= 0)
			{
				Shows.Show show = ((comboBoxShow.SelectedItem as Common.Controls.ComboBoxItem).Value) as Shows.Show;
				_scheduleItem.ShowID = show.ID;
			}
			DialogResult = System.Windows.Forms.DialogResult.OK;
			Close();
		}
开发者ID:stewmc,项目名称:vixen,代码行数:31,代码来源:SetupScheduleForm.cs


示例2: Main

		private static void Main()
		{

			try
			{
				AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
				Application.ThreadException += Application_ThreadException;
			 
				bool result;
				var mutex = new Mutex(true, "Vixen3RunningInstance", out result);

				if (!result)
				{
					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					MessageBoxForm.msgIcon = SystemIcons.Warning; //this is used if you want to add a system icon to the message form.
					var messageBox = new MessageBoxForm("Another instance is already running; please close that one before trying to start another.",
									"Vixen 3 already active", false, false);
					messageBox.ShowDialog();
					return;
				}

				Application.EnableVisualStyles();
				Application.SetCompatibleTextRenderingDefault(false);
				Application.Run(new VixenApplication());

				// mutex shouldn't be released - important line
				GC.KeepAlive(mutex);
			}
			catch (Exception ex)
			{
				Logging.Fatal(ErrorMsg, ex);
				Environment.Exit(1);
			}
		}
开发者ID:stewmc,项目名称:vixen,代码行数:34,代码来源:Program.cs


示例3: Show

 public DialogResult Show(IWin32Window parent, string message, string caption, MessageBoxButton button, MessageBoxIcon icon)
 {
     using(var msgbox = new MessageBoxForm(button, icon, message, caption))
     {
         return msgbox.ShowDialog(parent);
     }
 }
开发者ID:Kuzq,项目名称:gitter,代码行数:7,代码来源:CustomMessageBoxService.cs


示例4: Run

 public void Run()
 {
     using (StubLogging logging = new StubLogging())
     //using (ModuleLoader loader = new ModuleLoader(logging))
     {
         try
         {
             ConfiguratorConfiguration config = new ConfiguratorConfiguration(logging);
             Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru-RU", false);
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
             using (_mainForm = new MainForm(config))
                 Application.Run(_mainForm);
         }
         catch (Exception ex)
         {
             logging.WriteError(ex.ToString());
             using (MessageBoxForm dlg = new MessageBoxForm())
             {
                 dlg.ShowForm(null, ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error,
                              new[] {"OK"});
             }
         }
     }
 }
开发者ID:AlexSneg,项目名称:VIRD-1.0,代码行数:25,代码来源:ConfiguratorHostImpl.cs


示例5: Setup

		public override bool Setup()
		{
			//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
			MessageBoxForm.msgIcon = SystemIcons.Information; //this is used if you want to add a system icon to the message form.
			var messageBox = new MessageBoxForm("Nothing to Setup", "", false, false);
			messageBox.ShowDialog();
			return base.Setup();
		}
开发者ID:stewmc,项目名称:vixen,代码行数:8,代码来源:OpenDMXInstance.cs


示例6: Show

 public static DialogResult Show(
     IWin32Window owner, string text, string caption, MessageBoxButtons buttons,
     Bitmap icon, MessageBoxDefaultButton defaultButton, MessageBoxIcon beepType)
 {
     NativeMethods.MessageBeep((int)beepType);
     MessageBoxForm form = new MessageBoxForm();
     return form.ShowMessageBoxDialog(new MessageBoxArgs(
         owner, text, caption, buttons, icon, defaultButton));
 }
开发者ID:panshuiqing,项目名称:winform-ui,代码行数:9,代码来源:MessageBoxEx.cs


示例7: ScanButton_Click

		/// <summary>
		/// Scan for games
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void ScanButton_Click(object sender, EventArgs e)
		{
			MessageBoxForm form = new MessageBoxForm();
			form.StartPosition = FormStartPosition.CenterParent;
			var result = form.ShowForm("Scan for games on your computer?", "Scan", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
			if (result == DialogResult.OK)
			{
				var success = System.Threading.ThreadPool.QueueUserWorkItem(ScanGames);
				if (!success) ScanProgressLabel.Text = "Scan failed!";
			}
		}
开发者ID:XxRaPiDK3LLERxX,项目名称:nucleuscoop,代码行数:16,代码来源:GameSettingsUserControl.cs


示例8: buttonOK_Click

 private void buttonOK_Click(object sender, EventArgs e)
 {
     if (_PortAddress == 0)
     {
         //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
         MessageBoxForm.msgIcon = SystemIcons.Hand; //this is used if you want to add a system icon to the message form.
         var messageBox = new MessageBoxForm("The port address is 0.", "595 Setup", false, false);
         messageBox.ShowDialog();
         messageBox.DialogResult = DialogResult.None;
     }
     else {
         _data.Port = _PortAddress;
     }
 }
开发者ID:naztrain,项目名称:vixen,代码行数:14,代码来源:SetupDialog.cs


示例9: buttonOK_Click

 private void buttonOK_Click(object sender, EventArgs e)
 {
     if (TemplateName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0) {
         //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
         MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
         var messageBox = new MessageBoxForm("The template name must be a valid file name. Please ensure there are no invalid characters in the template name.",
             "Invalid Template Name", false, true);
         messageBox.ShowDialog();
         DialogResult = messageBox.DialogResult;
     }
     else {
         DialogResult = DialogResult.OK;
         Close();
     }
 }
开发者ID:naztrain,项目名称:vixen,代码行数:15,代码来源:PreviewCustomCreateForm.cs


示例10: buttonAddColorSet_Click

        private void buttonAddColorSet_Click(object sender, EventArgs e)
        {
            using (TextDialog textDialog = new TextDialog("New Color Set name?", "New Color Set")) {
                if (textDialog.ShowDialog() == DialogResult.OK) {
                    string newName = textDialog.Response;

                    if (_data.ContainsColorSet(newName)) {
                        //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                        MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
                        var messageBox = new MessageBoxForm("Color Set already exists.", "Error", false, false);
                        messageBox.ShowDialog();
                        return;
                    }

                    ColorSet newcs = new ColorSet();
                    _data.SetColorSet(newName, newcs);
                    UpdateGroupBoxWithColorSet(newName, newcs);
                    UpdateColorSetsList();
                }
            }
        }
开发者ID:jaredb7,项目名称:vixen,代码行数:21,代码来源:ColorSetsSetupForm.cs


示例11: Show

        public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, string[] buttonText, bool useCancelButton)
        {
            //int n = Application.OpenForms.Count - 1;
            //Form owner = null;
            //if (n > -1)
            //    owner = Application.OpenForms[n];

            //if (owner != null)
            //    owner.BringToFront();

            IntPtr zero = IntPtr.Zero;
            if (owner == null)
            {
                zero = Process.GetCurrentProcess().MainWindowHandle; 
                //zero = NativeMethod.GetActiveWindow();
                owner = Form.FromHandle(zero);
            }
            else
            {
                zero = owner.Handle;
            }

            DialogResult result;
            using (MessageBoxForm frm = new MessageBoxForm())
            {
                if (!useCancelButton)
                {
                    frm.ControlBox = false;
                    frm.CancelButton = new Button(); // Иначе по Esc закрывается форма.
                }
                result = frm.ShowForm(owner, text, caption, buttons, icon, buttonText, useCancelButton);
            }

            //if (zero != IntPtr.Zero)
            //{
            //    NativeMethod.SendMessage(zero, 7, 0, 0);
            //}

            return result;
        }
开发者ID:AlexSneg,项目名称:VIRD-1.0,代码行数:40,代码来源:MessageBoxExt.cs


示例12: buttonAddProfile_Click

        private void buttonAddProfile_Click(object sender, EventArgs e)
        {
            SaveCurrentItem();

            TextDialog dialog = new TextDialog("Enter a name for the new profile","Profile Name","New Profile");

            while (dialog.ShowDialog() == DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("Profile name can not be blank.",
                        "Error", false, false);
                    messageBox.ShowDialog();
                }

                if (comboBoxProfiles.Items.Cast<ProfileItem>().Any(items => items.Name == dialog.Response))
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Warning; //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("A profile with the name " + dialog.Response + @" already exists.", "", false, false);
                    messageBox.ShowDialog();
                }

                if (dialog.Response != string.Empty && comboBoxProfiles.Items.Cast<ProfileItem>().All(items => items.Name != dialog.Response))
                {
                    break;
                }

            }

            if (dialog.DialogResult == DialogResult.Cancel)
                return;

            ProfileItem item = new ProfileItem { Name = dialog.Response, DataFolder = _defaultFolder + " " + dialog.Response };
            comboBoxProfiles.Items.Add(item);
            comboBoxProfiles.SelectedIndex = comboBoxProfiles.Items.Count - 1;
            PopulateLoadProfileSection(false);
        }
开发者ID:naztrain,项目名称:vixen,代码行数:40,代码来源:DataProfileForm.cs


示例13: OkButton_Click

		private void OkButton_Click(object sender, EventArgs e)
		{
			if (portComboBox.SelectedIndex == _OtherAddressIndex) {
				if (PortAddress != 0) {
					try {
						Convert.ToUInt16(portTextBox.Text, 0x10);
					}
					catch {
						//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
						MessageBoxForm.msgIcon = SystemIcons.Hand; //this is used if you want to add a system icon to the message form.
						var messageBox = new MessageBoxForm("The port number is not a valid hexadecimal number.", "Parallel Port Setup", false, false);
						messageBox.ShowDialog();
						base.DialogResult = DialogResult.None;
					}
				}
				else {
					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					MessageBoxForm.msgIcon = SystemIcons.Hand; //this is used if you want to add a system icon to the message form.
					var messageBox = new MessageBoxForm("The port address is 0.", "Parallel Port Setup", false, false);
					messageBox.ShowDialog();
					DialogResult = DialogResult.None;
				}
			}
		}
开发者ID:stewmc,项目名称:vixen,代码行数:24,代码来源:ParallelPortConfig.cs


示例14: TimedSequenceEditorEffectEditor

        public TimedSequenceEditorEffectEditor(IEnumerable<EffectNode> effectNodes)
            : this(effectNodes.First())
        {
            if (effectNodes != null && effectNodes.Count() > 1) {
                _effectNodes = effectNodes;
                Text = "Edit Multiple Effects";

                // show a warning if multiple effect types are selected
                EffectNode displayedEffect = effectNodes.First();
                if (displayedEffect != null) {
                    foreach (EffectNode node in effectNodes) {
                        if (node.Effect.TypeId != displayedEffect.Effect.TypeId)
                        {
                            //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                            MessageBoxForm.msgIcon = SystemIcons.Warning; //this is used if you want to add a system icon to the message form.
                            var messageBox = new MessageBoxForm("The selected effects contain multiple types. Once you finish editing, these values will " +
                                            "only be applied to the effects of type '" + displayedEffect.Effect.Descriptor.TypeName + "'.", "Warning", false, false);
                            messageBox.ShowDialog();
                            break;
                        }
                    }
                }
            }
        }
开发者ID:naztrain,项目名称:vixen,代码行数:24,代码来源:TimedSequenceEditorEffectEditor.cs


示例15: EditValue

		public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
		{
			IWindowsFormsEditorService svc = (IWindowsFormsEditorService)
			                                 provider.GetService(typeof (IWindowsFormsEditorService));
			if (svc != null) {
				List<PreviewBaseShape> shapes = value as List<PreviewBaseShape>;
				if (shapes.Count < 1)
				{
					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
					var messageBox = new MessageBoxForm("Elements must have at least one shape. Remove the selected element.", "Error", false, false);
					messageBox.ShowDialog();
					if (value != null) return value;
				}
				PreviewSetElements elementsDialog = new PreviewSetElements(shapes);
				svc.ShowDialog(elementsDialog);
				// update etc
                if (shapes[0].Parent != null)
                {
                    shapes[0].Parent.Layout();
                }
			}
			return value;
		}
开发者ID:stewmc,项目名称:vixen,代码行数:24,代码来源:PreviewSetElementsUIEditor.cs


示例16: Start

        // -------------------------------------------------------------
        //
        // 	Startup() - called when the plugin is loaded
        //
        //
        // 	todo:
        //
        // 		1) probably add error checking on all 'new' operations
        // 		and system calls
        //
        // 		2) better error reporting and logging
        //
        //      3) Sequence # should be per universe
        //
        // -------------------------------------------------------------
        public override void Start()
        {
            bool cleanStart = true;

            base.Start();

            if(!PluginInstances.Contains(this))
                PluginInstances.Add(this);

            // working copy of networkinterface object
            NetworkInterface networkInterface;

            // a single socket to use for unicast (if needed)
            Socket unicastSocket = null;

            // working ipaddress object
            IPAddress ipAddress = null;

            // a sortedlist containing the multicast sockets we've already done
            var nicSockets = new SortedList<string, Socket>();

            // load all of our xml into working objects
            this.LoadSetupNodeInfo();

            // initialize plugin wide stats
            this._eventCnt = 0;
            this._totalTicks = 0;

            if (_data.Unicast == null && _data.Multicast == null)
                if (_data.Universes[0] != null && (_data.Universes[0].Multicast != null || _data.Universes[0].Unicast != null))
                {
                    _data.Unicast = _data.Universes[0].Unicast;
                    _data.Multicast = _data.Universes[0].Multicast;
                    if(!_updateWarn){
                        //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                        MessageBoxForm.msgIcon = SystemIcons.Information; //this is used if you want to add a system icon to the message form.
                        var messageBox = new MessageBoxForm("The E1.31 plugin is importing data from an older version of the plugin. Please verify the new Streaming ACN (E1.31) configuration.", "Vixen 3 Streaming ACN (E1.31) plugin", false, false);
                        messageBox.ShowDialog();
                        _updateWarn = true;
                    }
                }

            // find all of the network interfaces & build a sorted list indexed by Id
            this._nicTable = new SortedList<string, NetworkInterface>();

            NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
            foreach (var nic in nics)
            {
                if (nic.NetworkInterfaceType != NetworkInterfaceType.Tunnel && nic.NetworkInterfaceType != NetworkInterfaceType.Loopback)
                {
                    this._nicTable.Add(nic.Id, nic);
                }
            }

            if (_data.Unicast != null)
            {
                if (!unicasts.ContainsKey(_data.Unicast))
                {
                    unicasts.Add(_data.Unicast, 0);
                }
            }

            // initialize messageTexts stringbuilder to hold all warnings/errors
            this._messageTexts = new StringBuilder();

            // now we need to scan the universeTable
            foreach (var uE in _data.Universes)
            {
                // if it's still active we'll look into making a socket for it
                if (cleanStart && uE.Active)
                {
                    // if it's unicast it's fairly easy to do
                    if (_data.Unicast != null)
                    {
                        // is this the first unicast universe?
                        if (unicastSocket == null)
                        {
                            // yes - make a new socket to use for ALL unicasts
                            unicastSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                        }

                        // use the common unicastsocket
                        uE.Socket = unicastSocket;

                        IPAddress[] ips = null;
//.........这里部分代码省略.........
开发者ID:naztrain,项目名称:vixen,代码行数:101,代码来源:E131OutputPlugin.cs


示例17: btnRestore_Click

        private void btnRestore_Click(object sender, EventArgs e)
        {
            //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
            MessageBoxForm.msgIcon = SystemIcons.Hand; //this is used if you want to add a system icon to the message form.
            var messageBox = new MessageBoxForm("Are you sure you want to restore this version?  \n\rIf you have not saved the current file, all changes will be lost!", "Restore File", true, false);
            messageBox.ShowDialog();
            if (messageBox.DialogResult == DialogResult.OK)
            {

                var commit = _repo.Get<Commit>(this.txtChangeHash.Text);
                var tree = commit.Tree;
                foreach (Tree subtree in tree.Trees)
                {
                    var leaf = subtree.Leaves.Where(l => l.Path.Equals(treeViewFiles.SelectedNode.Tag as string)).FirstOrDefault();
                    if (leaf != null)
                    {

                        var rawData = leaf.RawData;
                        var fileName = System.IO.Path.Combine(_repo.WorkingDirectory, treeViewFiles.SelectedNode.Tag as string).Replace('/', '\\');
                        var b = fileName;
                        var c = b;
                        var fi = new FileInfo(fileName);
                        SaveFileDialog dlg = new SaveFileDialog();
                        dlg.FileName = fi.Name;
                        dlg.AddExtension = true;
                        dlg.DefaultExt = fi.Extension;
                        dlg.InitialDirectory = fi.DirectoryName;
                        dlg.Filter = "All files (*.*)|*.*";

                        var ddd = dlg.ShowDialog();
                        if (ddd == System.Windows.Forms.DialogResult.OK)
                        {
                            lock (Module.fileLockObject)
                            {
                                Module.restoringFile = true;
                                File.WriteAllBytes(fileName, rawData);
                            }
                        }
                    }
                }
            }
        }
开发者ID:naztrain,项目名称:vixen,代码行数:42,代码来源:Versioning.cs


示例18: btnOK_Click

 private void btnOK_Click(object sender, EventArgs e)
 {
     if (txtEffectCount.Value == 0)
     {
         //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
         MessageBoxForm.msgIcon = SystemIcons.Exclamation; //this is used if you want to add a system icon to the message form.
         var messageBox = new MessageBoxForm("OOPS! Your effect count is set to 0 (zero)", "Warning", false, false);
         messageBox.ShowDialog();
         DialogResult = DialogResult.None;
     }
     //Double check for calculations
     if (!TimeExistsForAddition() && !checkBoxAlignToBeatMarks.Checked && !checkBoxFillDuration.Checked )
     {
         //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
         MessageBoxForm.msgIcon = SystemIcons.Exclamation; //this is used if you want to add a system icon to the message form.
         var messageBox = new MessageBoxForm("At least one effect would be placed beyond the sequence length, and will not be added.\n\nWould you like to proceed anyway?", "Warning", true, false);
         messageBox.ShowDialog();
         if (messageBox.DialogResult == DialogResult.No)
         {
             DialogResult = DialogResult.None;
         }
     }
 }
开发者ID:naztrain,项目名称:vixen,代码行数:23,代码来源:Form_AddMultipleEffects.cs


示例19: checkBoxAlignToBeatMarks_CheckStateChanged

        private void checkBoxAlignToBeatMarks_CheckStateChanged(object sender, EventArgs e)
        {
            txtDurationBetween.Enabled = (checkBoxAlignToBeatMarks.Checked ? false : true);
            listBoxMarkCollections.Visible = !listBoxMarkCollections.Visible;
            listBoxMarkCollections.Enabled = checkBoxFillDuration.AutoCheck = checkBoxSkipEOBeat.AutoCheck = checkBoxAlignToBeatMarks.Checked;
            checkBoxSkipEOBeat.ForeColor = checkBoxAlignToBeatMarks.Checked ? ThemeColorTable.ForeColor : ThemeColorTable.ForeColorDisabled;
            checkBoxFillDuration.ForeColor = checkBoxAlignToBeatMarks.Checked ? ThemeColorTable.ForeColor : ThemeColorTable.ForeColorDisabled;
            if (checkBoxAlignToBeatMarks.Checked)
            {
                CalculatePossibleEffectsByBeatMarks();
            }
            else
            {
                CalculatePossibleEffects();
            }

            if (checkBoxAlignToBeatMarks.Checked)
            {
                var names = new HashSet<String>();
                foreach (MarkCollection mc in MarkCollections)
                {
                    if (!names.Add(mc.Name))
                    {
                        //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                        MessageBoxForm.msgIcon = SystemIcons.Warning; //this is used if you want to add a system icon to the message form.
                        var messageBox = new MessageBoxForm("You have Beat Mark collections with duplicate names.\nBecause of this, your results may not be as expected.", "Duplicate Names", false, false);
                        messageBox.ShowDialog();
                        break;
                    }
                }

            }
        }
开发者ID:naztrain,项目名称:vixen,代码行数:33,代码来源:Form_AddMultipleEffects.cs


示例20: toolStripButtonExportGradients_Click

		private void toolStripButtonExportGradients_Click(object sender, EventArgs e)
		{
			SaveFileDialog saveFileDialog = new SaveFileDialog
			{
				DefaultExt = ".vgl",
				Filter = @"Vixen 3 Color Gradient Library (*.vgl)|*.vgl|All Files (*.*)|*.*"
			};

			if (_lastFolder != string.Empty) saveFileDialog.InitialDirectory = _lastFolder;
			if (saveFileDialog.ShowDialog() != DialogResult.OK) return;
			_lastFolder = Path.GetDirectoryName(saveFileDialog.FileName);

			var xmlsettings = new XmlWriterSettings
			{
				Indent = true,
				IndentChars = "\t",
			};

			try
			{
				Dictionary<string, ColorGradient> gradients = _colorGradientLibrary.ToDictionary(gradient => gradient.Key, gradient => gradient.Value);

				DataContractSerializer ser = new DataContractSerializer(typeof(Dictionary<string, ColorGradient>));
				var writer = XmlWriter.Create(saveFileDialog.FileName, xmlsettings);
				ser.WriteObject(writer, gradients);
				writer.Close();
			}
			catch (Exception ex)
			{
				Logging.Error("While exporting Color Gradient Library: " + saveFileDialog.FileName + " " + ex.InnerException);
				//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
				MessageBoxForm.msgIcon = SystemIcons.Warning; //this is used if you want to add a system icon to the message form.
				var messageBox = new MessageBoxForm("Unable to export data, please check the error log for details.", "Unable to export", false, false);
				messageBox.ShowDialog();
			}
		}
开发者ID:stewmc,项目名称:vixen,代码行数:36,代码来源:Form_ToolPalette.cs



注:本文中的MessageBoxForm类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MessageBoxIcon类代码示例发布时间:2022-05-24
下一篇:
C# MessageBoxDefaultButton类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap