System.Windows.MessageBox.Show(string)

Here are the examples of the csharp api System.Windows.MessageBox.Show(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1091 Examples 7

19 Source : MainWindow.xaml.cs
with GNU General Public License v3.0
from 1RedOne

private void RegisterClient(int thisIndex)
        {
            GetWait();
            string ThisFilePath = System.IO.Directory.GetCurrentDirectory();
            Device ThisClient = Devices[thisIndex];
            log.Info($"[{ThisClient.Name}] - Beginning to process");
            //Update UI
            FireProgress(thisIndex, "CreatingCert...", 15);
            log.Info($"[{ThisClient.Name}] - About to generate cert at {ThisFilePath}...");
            X509Certificate2 newCert = FauxDeployCMAgent.CreateSelfSignedCertificate(ThisClient.Name);
            string myPath = ExportCert(newCert, ThisClient.Name, ThisFilePath);
            log.Info($"[{ThisClient.Name}] - Cert generated at {myPath}!");
            //Update UI
            FireProgress(thisIndex, "CertCreated!", 25);
            System.Threading.Thread.Sleep(1500);
            FireProgress(thisIndex, "Registering Client...", 30);
            SmsClientId clientId;
            log.Info($"[{ThisClient.Name}] - About to register with CM...");
            try
            {
                clientId = FauxDeployCMAgent.RegisterClient(CmServer, ThisClient.Name, DomainName, myPath, Preplacedword, log);
            }
            catch (Exception e)
            {
                log.Error($"[{ThisClient.Name}] - Failed to register with {e.Message}...");
                if (noisy)
                {
                    System.Windows.MessageBox.Show(" We failed with " + e.Message);
                    throw;
                }
                FireProgress(thisIndex, "ManagementPointErrorResponse...", 100);
                return;
            }
            //SmsClientId clientId = FauxDeployCMAgent.RegisterClient(CmServer, ThisClient.Name, DomainName, myPath, Preplacedword);

            FireProgress(thisIndex, "Starting Inventory...", 50);
            FauxDeployCMAgent.SendDiscovery(CmServer, ThisClient.Name, DomainName, SiteCode, myPath, Preplacedword, clientId, log, InventoryIsChecked);

            FireProgress(thisIndex, "RequestingPolicy", 75);
            //FauxDeployCMAgent.GetPolicy(CMServer, SiteCode, myPath, Preplacedword, clientId);

            FireProgress(thisIndex, "SendingCustom", 85);
            FauxDeployCMAgent.SendCustomDiscovery(CmServer, ThisClient.Name, SiteCode, ThisFilePath, CustomClientRecords);

            FireProgress(thisIndex, "Complete", 100);
        }

19 Source : CodeGenerate.cs
with MIT License
from 2881099

public async Task<string> Setup(TaskBuild taskBuild, List<DbTableInfo> outputTables)
        {
            try
            {
                var paths = await Task.Run(() =>
                {
                    var config = new TemplateServiceConfiguration();
                    config.EncodedStringFactory = new RawStringFactory();
                    Engine.Razor = RazorEngineService.Create(config);

                    string path = string.Empty;


                    foreach (var templatesPath in taskBuild.Templates)
                    {
                        path = $"{taskBuild.GeneratePath}\\{taskBuild.DbName}\\{templatesPath.Replace(".tpl", "").Trim()}";
                        if (!Directory.Exists(path)) Directory.CreateDirectory(path);

                        var razorId = Guid.NewGuid().ToString("N");
                        var html = File.ReadAllText(Path.Combine(Environment.CurrentDirectory, "Templates", templatesPath));
                        Engine.Razor.Compile(html, razorId);
                        //开始生成操作
                        foreach (var table in outputTables)
                        {
                            var sw = new StringWriter();
                            var model = new RazorModel(taskBuild, outputTables, table);
                            Engine.Razor.Run(razorId, sw, null, model);
                            StringBuilder plus = new StringBuilder();
                            plus.AppendLine("//------------------------------------------------------------------------------");
                            plus.AppendLine("// <auto-generated>");
                            plus.AppendLine("//     此代码由工具生成。");
                            plus.AppendLine("//     运行时版本:" + Environment.Version.ToString());
                            plus.AppendLine("//     Website: http://www.freesql.net");
                            plus.AppendLine("//     对此文件的更改可能会导致不正确的行为,并且如果");
                            plus.AppendLine("//     重新生成代码,这些更改将会丢失。");
                            plus.AppendLine("// </auto-generated>");
                            plus.AppendLine("//------------------------------------------------------------------------------");
                            plus.Append(sw.ToString());
                            plus.AppendLine();
                            var outPath = $"{path}\\{taskBuild.FileName.Replace("{name}", model.GetCsName(table.Name))}";
                            if (!string.IsNullOrEmpty(taskBuild.RemoveStr))
                                outPath = outPath.Replace(taskBuild.RemoveStr, "").Trim();
                            File.WriteAllText(outPath, plus.ToString());
                        }
                    }
                    return path;
                });
                Process.Start(paths);
                return "生成成功";
            }
            catch (Exception ex)
            {
                MessageBox.Show($"生成时发生异常,请检查模版代码: {ex.Message}.");
                return $"生成时发生异常,请检查模版代码: {ex.Message}.";
            }
        }

19 Source : EditMacroItemWindow.xaml.cs
with MIT License
from 3RD-Dimension

private void ButtonOk_Click(object sender, RoutedEventArgs e)
		{
			if (MacroName.Contains(':') || MacroName.Contains(';') || Commands.Contains(':') || Commands.Contains(';'))
			{
				MessageBox.Show("Name and Commands can't include ':' or ';'");
				return;
			}
			Ok = true;
			Close();
		}

19 Source : GrblSettingsWindow.xaml.cs
with MIT License
from 3RD-Dimension

private async void ButtonApply_Click(object sender, RoutedEventArgs e)
        {
            List<Tuple<int, double>> ToSend = new List<Tuple<int, double>>();

            foreach (KeyValuePair<int, double> kvp in CurrentSettings)
            {
                double newval;

                if (!double.TryParse(SettingsBoxes[kvp.Key].Text, System.Globalization.NumberStyles.Float, Util.Constants.DecimalParseFormat, out newval))
                {
                    MessageBox.Show($"Value \"{SettingsBoxes[kvp.Key].Text}\" is invalid for Setting \"{Util.GrblCodeTranslator.Settings[kvp.Key].Item1}\"");
                    return;
                }

                if (newval == kvp.Value)
                    continue;

                ToSend.Add(new Tuple<int, double>(kvp.Key, newval));
            }

            if (SendLine == null)
                return;

            foreach (Tuple<int, double> setting in ToSend)
            {
                SendLine.Invoke($"${setting.Item1}={setting.Item2.ToString(Util.Constants.DecimalOutputFormat)}");
                CurrentSettings[setting.Item1] = setting.Item2;
                await Task.Delay(Properties.Settings.Default.SettingsSendDelay);
            }
        }

19 Source : MainWindow.xaml.EditTab.cs
with MIT License
from 3RD-Dimension

private void ButtonEditRotateCW_Click(object sender, RoutedEventArgs e)
		{
			if (machine.Mode == Machine.OperatingMode.SendFile)
				return;

			try
			{
				machine.SetFile(ToolPath.RotateCW().GetGCode());
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}

19 Source : MainWindow.xaml.MachineStatus.cs
with MIT License
from 3RD-Dimension

private void Machine_FileChanged()
		{
			try
			{
				ToolPath = GCodeFile.FromList(machine.File);
				GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); // prevents considerable increase in memory usage
			}
			catch (Exception ex)
			{
				MessageBox.Show("Could not parse GCode File, no preview/editing available\nrun this file at your own risk\n" + ex.Message + "\n\n\ninternal:\n" + ex.StackTrace);
			}

			if (ToolPath.Warnings.Count > 0)
			{
                if (Properties.Settings.Default.ShowWarningWindow) // If ShowWarningWindow == True, Display when file loaded
                { 
				WarningWindow ww = new WarningWindow(@"Parsing this file resulted in some warnings!
Do not use GCode Sender's edit functions unless you are sure that these warnings can be ignored!
If you use edit functions, check the output file for errors before running the gcode!
Be aware that the affected lines will likely move when using edit functions." + "\n\n" + "The warning is only applicable to what will be displayed in the viewer, " +
"and will not affect the normal running of the code." + "\n\n", ToolPath.Warnings);

				ww.ShowDialog();
			    }
            }

            if (Properties.Settings.Default.EnableCodePreview)
				ToolPath.GetModel(ModelLine, ModelRapid, ModelArc);

			RunFileLength.Text = machine.File.Count.ToString();
			FileRunTime = TimeSpan.Zero;
			RunFileDuration.Text = ToolPath.TotalTime.ToString(@"hh\:mm\:ss");
			RunFileRunTime.Text = "00:00:00";

			int digits = (int)Math.Ceiling(Math.Log10(machine.File.Count));

			string format = "D" + digits;


			ListViewFile.Items.Clear();

			for (int line = 0; line < machine.File.Count; line++)
			{
				TextBlock tb = new TextBlock() { Text = $"{(line + 1).ToString(format)} : {machine.File[line]}" };

				if (machine.PauseLines[line])
					tb.Background = Brushes.YellowGreen;

				ListViewFile.Items.Add(tb);
			}

			TextBlock tbFinal = new TextBlock() { Text = "-- FILE END --" };
			ListViewFile.Items.Add(tbFinal);

			if (ToolPath.ContainsMotion)
			{
				ModelFileBoundary.Points.Clear();
				Point3DCollection boundary = new Point3DCollection();

				Vector3 MinPoint = ToolPath.MinFeed;
				Vector3 MaxPoint = ToolPath.MaxFeed;

				for (int ax = 0; ax < 3; ax++)
				{
					for (int mask = 0; mask < 4; mask++)
					{
						Vector3 point = MinPoint;

						for (int i = 0; i < 2; i++)
						{
							// binary integer logic? hell yeah!
							if (((mask >> i) & 0x01) == 1)
							{
								point[(ax + i + 1) % 3] = MaxPoint[(ax + i + 1) % 3];
							}
						}

						boundary.Add(point.ToPoint3D());

						point[ax] = MaxPoint[ax];
						boundary.Add(point.ToPoint3D());
					}
				}

				ModelFileBoundary.Points = boundary;

				ModelTextMinPoint.Text = string.Format(Constants.DecimalOutputFormat, "(-X {0:0.###}, -Y {1:0.###}, -Z {2:0.###})", MinPoint.X, MinPoint.Y, MinPoint.Z);
				ModelTextMaxPoint.Text = string.Format(Constants.DecimalOutputFormat, "(+X {0:0.###}, +Y {1:0.###}, +Z {2:0.###})", MaxPoint.X, MaxPoint.Y, MaxPoint.Z);
				ModelTextMinPoint.Position = MinPoint.ToPoint3D();
				ModelTextMaxPoint.Position = MaxPoint.ToPoint3D();
				ModelFileBoundaryPoints.Points.Clear();
				ModelFileBoundaryPoints.Points.Add(MinPoint.ToPoint3D());
				ModelFileBoundaryPoints.Points.Add(MaxPoint.ToPoint3D());
			}
			else
			{
				ModelFileBoundary.Points.Clear();
				ModelFileBoundaryPoints.Points.Clear();
				ModelTextMinPoint.Text = "";
				ModelTextMaxPoint.Text = "";
			}
		}

19 Source : SettingsWindow.xaml.cs
with MIT License
from 3RD-Dimension

private void ComboBoxSerialPort_DropDownOpened(object sender, EventArgs e)
		{
			ComboBoxSerialPort.Items.Clear();

			Dictionary<string, string> ports = new Dictionary<string, string>();

			try
			{
				ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_SerialPort");
				foreach (ManagementObject queryObj in searcher.Get())
				{
					string id = queryObj["DeviceID"] as string;
					string name = queryObj["Name"] as string;

					ports.Add(id, name);
				}
			}
			catch (ManagementException ex)
			{
				MessageBox.Show("An error occurred while querying for WMI data: " + ex.Message);
			}

			// fix error of some boards not being listed properly
			foreach (string port in SerialPort.GetPortNames())
			{
				if (!ports.ContainsKey(port))
				{
					ports.Add(port, port);
				}
			}

			foreach (var port in ports)
			{
				ComboBoxSerialPort.Items.Add(new ComboBoxItem() { Content = port.Value, Tag = port.Key });
			}
		}

19 Source : MainWindow.xaml.cs
with MIT License
from 3RD-Dimension

private void UnhandledException(object sender, UnhandledExceptionEventArgs ea)
		{
			Exception e = (Exception)ea.ExceptionObject;

			string info = "Unhandled Exception:\r\nMessage:\r\n";
			info += e.Message;
			info += "\r\nStackTrace:\r\n";
			info += e.StackTrace;
			info += "\r\nToString():\r\n";
			info += e.ToString();

			MessageBox.Show("There has been an Unhandled Exception, the error has been logged to a file in the directory");
            Logger.Error(info);

            Environment.Exit(1);
		}

19 Source : MainWindow.xaml.cs
with MIT License
from 3RD-Dimension

private void Window_Drop(object sender, DragEventArgs e)
		{
			if (e.Data.GetDataPresent(DataFormats.FileDrop))
			{
				string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

				if (files.Length > 0)
				{
					string file = files[0];

                     if (machine.Mode == Machine.OperatingMode.SendFile)
                    
						return;

						try
						{
							machine.SetFile(System.IO.File.ReadAllLines(file));
						}
						catch (Exception ex)
						{
							MessageBox.Show(ex.Message);
						}
				}
			}
		}

19 Source : MainWindow.xaml.FileTab.cs
with MIT License
from 3RD-Dimension

private void OpenFileDialogGCode_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
		{
			if (machine.Mode == Machine.OperatingMode.SendFile)
				return;

			CurrentFileName = "";
            ReloadCurrentFileName = "";
			ToolPath = GCodeFile.Empty;

			try
			{
				machine.SetFile(System.IO.File.ReadAllLines(openFileDialogGCode.FileName));
                CurrentFileName = System.IO.Path.GetFullPath(openFileDialogGCode.FileName);
                ReloadCurrentFileName = CurrentFileName;
            }
			catch (Exception ex)
			{
                Logger.Warn(ex.Message);
                MessageBox.Show(ex.Message);                
			}
		}

19 Source : MainWindow.xaml.FileTab.cs
with MIT License
from 3RD-Dimension

private void ReloadCurrentFile()
        {
            if (ReloadCurrentFileName == "")
                return;

            ToolPath = GCodeFile.Empty;

            try
            {
                machine.SetFile(System.IO.File.ReadAllLines(ReloadCurrentFileName));
                CurrentFileName = ReloadCurrentFileName;
            }
            catch (Exception ex)
            {
                Logger.Warn("Failed to reload file " + ex.Message);
                MessageBox.Show(ex.Message);
            }
        }

19 Source : MainWindow.xaml.FileTab.cs
with MIT License
from 3RD-Dimension

private void SaveFileDialogGCode_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
		{
			if (machine.Mode == Machine.OperatingMode.SendFile)
				return;

			try
			{
				ToolPath.Save(saveFileDialogGCode.FileName);
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}

19 Source : MainWindow.xaml.MachineTab.cs
with MIT License
from 3RD-Dimension

private void ButtonConnect_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                machine.Connect();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

19 Source : MainWindow.xaml.MachineTab.cs
with MIT License
from 3RD-Dimension

private void ButtonDisconnect_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                machine.Disconnect();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

19 Source : ExportAndScreenshotOptionsChart.xaml.cs
with MIT License
from ABTSoftware

private bool GetAndCheckPath(string filter, out string path)
        {
            var ret = false;
            var isGoodPath = false;
            var saveFileDialog = CreateFileDialog(filter);
            path = null;

            while (!isGoodPath)
            {
                if (saveFileDialog.ShowDialog() == true)
                {
                    if (IsFileGoodForWriting(saveFileDialog.FileName))
                    {
                        path = saveFileDialog.FileName;
                        isGoodPath = true;
                        ret = true;
                    }
                    else
                    {
                        MessageBox.Show(
                            "File is inaccesible for writing or you can not create file in this location, please choose another one.");
                    }
                }
                else
                {
                    isGoodPath = true;
                }
            }

            return ret;
        }

19 Source : DigitalAnalyzerExampleViewModel.cs
with MIT License
from ABTSoftware

private async Task AddChannels(int digitalChannelsCount, int replacedogChannelsCount)
        {
            List<byte[]> digitalChannels = new List<byte[]>();
            List<float[]> replacedogChannels = new List<float[]>();

            // Force GC to free memory
            GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true);

            try
            {
                // Allocate memory first
                await Task.Run(() =>
                {
                    for (var i = 0; i < digitalChannelsCount; i++)
                    {
                        var newArray = new byte[SelectedPointCount];
                        digitalChannels.Add(newArray);
                    }

                    for (var i = 0; i < replacedogChannelsCount; i++)
                    {
                        var newArray = new float[SelectedPointCount];
                        replacedogChannels.Add(newArray);
                    }
                });

                // Generate random data and fill channels
                await GenerateData(digitalChannels, replacedogChannels);
            }
            catch (OutOfMemoryException)
            {
                await Application.Current.Dispatcher.BeginInvoke(new Action(() => ChannelViewModels.Clear()));
                MessageBox.Show(string.Format($"There is not enough RAM memory to allocate {SelectedChannelCount} channels with {SelectedPointCount} points each. Please select less channels or less points and try again."));
            }
            finally
            {
                OnPropertyChanged(nameof(IsEmpty));
                OnPropertyChanged(nameof(ChannelViewModels));
                OnPropertyChanged(nameof(SelectedPointCount));
                OnPropertyChanged(nameof(TotalPoints));
                OnPropertyChanged(nameof(XRange));

                IsLoading = false;
            }
        }

19 Source : AudioAnalyzerViewModel.cs
with MIT License
from ABTSoftware

private void HandleInputDeviceChange(string newId)
        {
            _audioDeviceHandler?.Dispose();
            _audioDeviceHandler = null;
            if (_audioDatareplacedyzer != null)
            {
                _audioDatareplacedyzer.Update -= Update;
                _audioDatareplacedyzer = null;
            }

            if(newId == null)
            {
                newId = FindDefaultDevice();

                if (newId == null)
                {
                    MessageBox.Show("Unable to find capture device, please make sure that you have connected mic");
                    return;
                }
                SelectedDeviceId = newId;
                return;
            }
            _audioDeviceHandler = _audioDeviceSource.CreateHandlder(newId);
            _audioDatareplacedyzer = new AudioDatareplacedyzer(_audioDeviceHandler);
            _audioDatareplacedyzer.Update += Update;
            InitDataStorage(_audioDatareplacedyzer, _audioDeviceHandler);
            _audioDeviceHandler.Start();
        }

19 Source : AudioAnalyzerViewModel.cs
with MIT License
from ABTSoftware

public void OnExampleEnter()
        {
            // We must clean up the audio client (if any), otherwise it will block app shutdown
            _dispatcher.ShutdownStarted += DispatcherShutdownStarted;

            try
            {
                Init();
            }
            catch
            {
                MessageBox.Show("Unable to use default audio device");
            }
        }

19 Source : App.xaml.cs
with MIT License
from ABTSoftware

private void Application_Startup(object sender, StartupEventArgs e)
        {
            if (e.Args.Contains(_devMode, StringComparer.InvariantCultureIgnoreCase))
            {
                DeveloperModManager.Manage.IsDeveloperMode = true;
            }

            if (e.Args.Contains(_quickStart, StringComparer.InvariantCultureIgnoreCase))
            {
                // Used in automation testing, disable animations and delays in transitions 
                UIAutomationTestMode = true;
                SeriesAnimationBase.GlobalEnableAnimations = false;
            }

            try
            {
                Thread.CurrentThread.Name = "UI Thread";

                Log.Debug("--------------------------------------------------------------");
                Log.DebugFormat("SciChart.Examples.Demo: Session Started {0}",
                    DateTime.Now.ToString("dd MMM yyyy HH:mm:ss"));
                Log.Debug("--------------------------------------------------------------");

                var replacedembliesToSearch = new[]
                {
                    typeof (MainWindowViewModel).replacedembly,
                    typeof (AbtBootstrapper).replacedembly, // SciChart.UI.Bootstrap
                    typeof (IViewModelTrait).replacedembly, // SciChart.UI.Reactive 
                };

                _bootStrapper = new Bootstrapper(ServiceLocator.Container, new AttributedTypeDiscoveryService(new ExplicitreplacedemblyDiscovery(replacedembliesToSearch)));
                _bootStrapper.InitializeAsync().Then(() =>
                {
                    if (!UIAutomationTestMode)
                    {
                        // Do this on background thread
                        Task.Run(() =>
                        {
                            //Syncing usages 
                            var syncHelper = ServiceLocator.Container.Resolve<ISyncUsageHelper>();
                            syncHelper.LoadFromIsolatedStorage();

                            //Try sync with service
                            syncHelper.GetRatingsFromServer();
                            syncHelper.SendUsagesToServer();
                            syncHelper.SetUsageOnExamples();
                        });
                    }

                    _bootStrapper.OnInitComplete();
                }).Catch(ex =>
                {
                    Log.Error("Exception:\n\n{0}", ex);
                    MessageBox.Show("Exception occurred in SciChart.Examples.Demo.\r\n. Please send log files located at %CurrentUser%\\AppData\\Local\\SciChart\\SciChart.Examples.Demo.log to support");
                });
            }
            catch (Exception caught)
            {
                Log.Error("Exception:\n\n{0}", caught);
                MessageBox.Show("Exception occurred in SciChart.Examples.Demo.\r\n. Please send log files located at %CurrentUser%\\AppData\\Local\\SciChart\\SciChart.Examples.Demo.log to support");
            }
        }

19 Source : MainWindow.xaml.cs
with MIT License
from ABTSoftware

private void OnZoomExtentsCompleted(object sender, EventArgs e)
        {
            MessageBox.Show("Zoom extents completed!");
        }

19 Source : HitTestGetPoint3D.xaml.cs
with MIT License
from ABTSoftware

private void SciChart_OnMouseUp(object sender, MouseButtonEventArgs mouseButtonEventArgs)
        {
            // Perform hit test on the series
            HitTestInfo3D hitTestInfo = renderSeries.HitTest(Mouse.GetPosition(sciChart));

            // Check if hit test was successful
            if (IreplacedPointValid(hitTestInfo))
            {
                // Convert the hit test result to a series info
                var seriesInfo = renderSeries.ToSeriesInfo(hitTestInfo);
                // Retrieve XYZ of clicked point from series info
                MessageBox.Show($"Clicked point: X [ {seriesInfo.HitVertex.X} ] Y [ {seriesInfo.HitVertex.Y} ] Z [ {seriesInfo.HitVertex.Z} ]");
            }
        }

19 Source : HtmlExportHelper.cs
with MIT License
from ABTSoftware

public static void ExportExampleToHtml(Example example, bool isUniqueExport = true)
        {
            if (isUniqueExport)
            {
                if (!GetPathForExport())
                {
                    MessageBox.Show("Bad path. Please, try export once more.");
                    return;
                }
            }

            var replacedembly = typeof (HtmlExportHelper).replacedembly;

            string[] names = replacedembly.GetManifestResourceNames();

            var templateFile = names.SingleOrDefault(x => x.Contains(TemplateFileName));

            using (var s = replacedembly.GetManifestResourceStream(templateFile))
            using (var sr = new StreamReader(s))
            {
                string lines = sr.ReadToEnd();

                var exampleFolderPath = ExportPath;//string.Format("{0}{1}\\", ExportPath, example.replacedle);
                //CreateExampleFolder(exampleFolderPath);

                PrintMainWindow("scichart-wpf-chart-example-" + example.replacedle.ToLower().Replace(" ", "-"), exampleFolderPath);
                
                lines = ReplaceTagsWithExample(lines, example);
                var fileName = string.Format("wpf-{0}chart-example-{1}.html",                    
                    example.TopLevelCategory.ToUpper().Contains("3D") || example.replacedle.ToUpper().Contains("3D") ? "3d-" : string.Empty,
                    example.replacedle.ToLower().Replace(" ", "-"));

                File.WriteAllText(Path.Combine(ExportPath, fileName), lines);
            }
            
        }

19 Source : ExceptionView.xaml.cs
with MIT License
from ABTSoftware

private void EmailSupport_Click(object sender, RoutedEventArgs e)
        {
            string email = "mailto:[email protected]?subject=Unhandled%20Exception&body=" + Uri.EscapeDataString(FormatEmail());
            try
            {
                Process.Start(email);
            }
            catch (Exception)
            {
                MessageBox.Show(
                    "We have not detected an email client on your PC!\r\nPlease email [email protected] with the exception message.");
            }
        }

19 Source : DigitalAnalyzerExampleViewModel.cs
with MIT License
from ABTSoftware

private async Task AddChannels(int digitalChannelsCount)
        {
            var digitalChannels = new List<byte[]>();

            // Force GC to free memory
            GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
            GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true);

            try
            {
                // Allocate memory first
                await Task.Run(() =>
                {
                    for (var i = 0; i < digitalChannelsCount; i++)
                    {
                        var newArray = new byte[SelectedPointCount];
                        digitalChannels.Add(newArray);
                    }
                });

                // Generate random data and fill channels
                await GenerateData(digitalChannels);
            }
            catch (OutOfMemoryException)
            {
                await Application.Current.Dispatcher.BeginInvoke(new Action(() => ChannelViewModels.Clear()));
                MessageBox.Show(string.Format($"There is not enough RAM memory to allocate {SelectedChannelCount} channels with {SelectedPointCount} points each. Please select less channels or less points and try again."));
            }
            finally
            {
                OnPropertyChanged(nameof(IsEmpty));
                OnPropertyChanged(nameof(ChannelViewModels));
                OnPropertyChanged(nameof(SelectedPointCount));
                OnPropertyChanged(nameof(TotalPoints));
                OnPropertyChanged(nameof(XRange));

                IsLoading = false;
            }
        }

19 Source : MainWindow.xaml.cs
with MIT License
from ABTSoftware

private void Control_OnPreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            MessageBox.Show("Double Click! " + sender.GetType().Name);
            e.Handled = true;
        }

19 Source : MainControl.xaml.cs
with MIT License
from Actipro

private void CreateCommands() {
			searchCommand = new DelegateCommand<object>((param) => {
				MessageBox.Show("Search button clicked.");
			});
		}

19 Source : MainWindow.xaml.cs
with MIT License
from Actipro

private void fileSaveCommand_Execute(object sender, ExecutedRoutedEventArgs e) {
			MessageBox.Show("Save file here.");
		}

19 Source : MainControl.xaml.cs
with MIT License
from Actipro

private void OnRemoveButtonClick(object sender, RoutedEventArgs e) {
			switch (controlTypeList.SelectedIndex) {
				case 0:
					// Remove the last control in the QAT
					if (ribbon.QuickAccessToolBarItems.Count > 0)
						ribbon.QuickAccessToolBarItems.RemoveAt(ribbon.QuickAccessToolBarItems.Count - 1);
					else
						MessageBox.Show("There are no controls remaining on this ribbon's Quick Access ToolBar to remove.");
					break;
				case 1:
					// Remove the last control in the tab panel
					if (ribbon.TabPanelItems.Count > 0)
						ribbon.TabPanelItems.RemoveAt(ribbon.TabPanelItems.Count - 1);
					else
						MessageBox.Show("There are no controls remaining on this ribbon's tab panel to remove.");
					break;
				case 2:
					// Remove the last Tab
					if (ribbon.Tabs.Count > 1)
						ribbon.Tabs.RemoveAt(ribbon.Tabs.Count - 1);
					else
						MessageBox.Show("There must be at least one tab left.");
					break;
				case 3:
					// Remove the last Group
					if (ribbon.SelectedTab.Items.Count > 0)
						ribbon.SelectedTab.Items.RemoveAt(ribbon.SelectedTab.Items.Count - 1);
					else
						MessageBox.Show("There are no groups remaining on this tab to remove.");
					break;
				default: {  
					// Remove the last new control in the first group
					if ((ribbon.SelectedTab != null) && (ribbon.SelectedTab.Items.Count > 0)) {
						RibbonControls.Group group = (RibbonControls.Group)ribbon.SelectedTab.Items[0];
						if (group.Items.Count > 0) {
							group.Items.RemoveAt(group.Items.Count - 1);
						}
						else
							MessageBox.Show("There are no controls in the last group to remove a control from.");
					}
					break;
				}
			}
		}

19 Source : MainControl.xaml.cs
with MIT License
from Actipro

private static void OnCustomMenuItemClicked(object sender, RibbonControls.ExecuteRoutedEventArgs e) {
			e.Handled = true;
			RibbonControls.Button button = (RibbonControls.Button)sender;
			WeakReference ownerRef = (WeakReference)button.Tag;
			MessageBox.Show(String.Format("You clicked the programmatically-added menu item for: {0}", ownerRef.Target));
		}

19 Source : MainControl.xaml.cs
with MIT License
from Actipro

private void OnSaveStateButtonClick(object sender, RoutedEventArgs e) {
			// Save the serialized list of QAT items
			serializedQareplacedems = ribbon.SerializeQuickAccessToolBarItems();
			
			MessageBox.Show("The current items in the QAT (in the actual Ribbon) have now been serialized to a string that can be restored later.\r\n\r\nNow make some more QAT item changes and be sure to apply them if you are using the customization controls.\r\nAfter changes are made, use the Load QAT State button to reload the persisted item data.");

			// Enable the load QAT state button
			loadQatStateButton.IsEnabled = true;
		}

19 Source : MainControl.xaml.cs
with MIT License
from Actipro

private void OnApplicationHelpExecute(object sender, ExecutedRoutedEventArgs e) {
			// First look to see if a screentip is displayed, and if so, show the context help for that
			if (ScreenTipService.CurrentScreenTip != null) {
				MessageBox.Show(String.Format("Show the help topic for '{0}' here if appropriate.\r\n\r\nThe owner element is: {1}\r\nThe pre-defined help URI is: {2}", 
					ScreenTipService.CurrentScreenTip.Header, ScreenTipService.CurrentScreenTip.OwnerElement, 
					(ScreenTipService.CurrentScreenTip.HelpUri != null ? ScreenTipService.CurrentScreenTip.HelpUri.AbsoluteUri : "<null>")));
				return;
			}

			// Show default help topic
			MessageBox.Show("Show the default help topic here.");
		}

19 Source : MainControl.xaml.cs
with MIT License
from Actipro

private void OnCancelButtonClick(object sender, RoutedEventArgs e) {
			MessageBox.Show("The dialog was canceled.");
		}

19 Source : MainControl.xaml.cs
with MIT License
from Actipro

private void OnOkButtonClick(object sender, RoutedEventArgs e) {
			var selectedViewModel = treeListBox.SelectedItem as ShellObjectViewModel;
			if (selectedViewModel != null)
				MessageBox.Show(string.Format("The '{0}' folder with parsing name '{1}' was selected.", selectedViewModel.Name, selectedViewModel.ParsingName));
			else
				MessageBox.Show("Nothing was selected.");
		}

19 Source : MainWindow.xaml.cs
with MIT License
from Actipro

private void applicationExitCommand_Execute(object sender, ExecutedRoutedEventArgs e) {
			if (BrowserInteropHelper.IsBrowserHosted) {
				Page currentPage = (Page)VisualTreeHelperExtended.GetAncestor(this, typeof(Page));
				if ((currentPage != null) && (currentPage.NavigationService.CanGoBack))
					currentPage.NavigationService.Navigate(Application.Current.StartupUri);
				else
					MessageBox.Show("Exit the application here.");
			}
			else {
				Window window = (Window)ActiproSoftware.Windows.Media.VisualTreeHelperExtended.GetAncestor(ribbon, typeof(Window));
				if (window != null)
					window.Close();
			}
		}

19 Source : MainWindow.xaml.cs
with MIT License
from Actipro

private void showDialogCommand_Execute(object sender, ExecutedRoutedEventArgs e) {
			MessageBox.Show(String.Format("Show the {0} dialog here.", e.Parameter));
		}

19 Source : MainWindow.xaml.cs
with MIT License
from Actipro

private void commentsCommand_Execute(object sender, ExecutedRoutedEventArgs e) {
			MessageBox.Show("Show the comments pane here.");
		}

19 Source : MainWindow.xaml.cs
with MIT License
from Actipro

private void customizeQuickAccessToolBarCommand_Execute(object sender, ExecutedRoutedEventArgs e) {
			if (BrowserInteropHelper.IsBrowserHosted)
				MessageBox.Show("Show an application options dialog with the Customize QAT tab selected here.  The downloadable evaluation includes a complete working implementation of the Customize QAT dialog.  The IsCustomizeQuickAccessToolBarMenuItemVisible option controls whether the menu item you clicked is visible.");
			else
				this.ShowOptionsWindow();
		}

19 Source : MainControl.xaml.cs
with MIT License
from Actipro

private void OnAddButtonClick(object sender, RoutedEventArgs e) {
			switch (controlTypeList.SelectedIndex) {
				case 0: {  
					// Add a new QAT control
					ribbon.QuickAccessToolBarItems.Add(this.CreateRandomChildControl(1));
					break;
				}
				case 1: {  
					// Add a new tab panel control
					ribbon.TabPanelItems.Add(this.CreateRandomChildControl(1));
					break;
				}
				case 2: {  
					// Add a new Tab
					RibbonControls.Tab newTab = new RibbonControls.Tab();
					newTab.Label = controlLabelTextBox.Text.Trim();
					ribbon.Tabs.Add(newTab);
					ribbon.SelectedTab = newTab;
					break;
				}
				case 3: {  
					// Add a new Group
					RibbonControls.Group newGroup = new RibbonControls.Group();
					newGroup.Label = controlLabelTextBox.Text.Trim();
					newGroup.Variants.Add(new RibbonControls.GroupVariant(groupVariantPriority++, RibbonControls.VariantSize.Medium));
					newGroup.Variants.Add(new RibbonControls.GroupVariant(groupVariantPriority++, RibbonControls.VariantSize.Collapsed));
					ribbon.SelectedTab.Items.Add(newGroup);

					// Add some sample child controls
					RibbonControls.StackPanel panel = new RibbonControls.StackPanel();
					panel.Children.Add(this.CreateRandomChildControl(1));
					panel.Children.Add(this.CreateRandomChildControl(2));
					panel.Children.Add(this.CreateRandomChildControl(3));
					newGroup.Items.Add(panel);
					break;
				}
				default: {  
					// Add a new control to the first group
					if ((ribbon.SelectedTab != null) && (ribbon.SelectedTab.Items.Count > 0)) {
						RibbonControls.Group group = (RibbonControls.Group)ribbon.SelectedTab.Items[0];
						group.Items.Add(this.CreateRandomChildControl(1));
					}
					else
						MessageBox.Show("There are no groups on the current tab to add a control to.");
					break;
				}
			}
		}

19 Source : MainWindow.xaml.cs
with MIT License
from Actipro

private void applicationHelpCommand_Execute(object sender, ExecutedRoutedEventArgs e) {
			// First look to see if a screentip is displayed, and if so, show the context help for that
			if (ScreenTipService.CurrentScreenTip != null) {
				MessageBox.Show(String.Format("Show the help topic for '{0}' here if appropriate.\r\n\r\nThe owner element is: {1}\r\nThe pre-defined help URI is: {2}", 
					ScreenTipService.CurrentScreenTip.Header, ScreenTipService.CurrentScreenTip.OwnerElement, 
					(ScreenTipService.CurrentScreenTip.HelpUri != null ? ScreenTipService.CurrentScreenTip.HelpUri.AbsoluteUri : "<null>")));
				return;
			}

			// Show default help topic
			MessageBox.Show("Show the default help topic here.");
		}

19 Source : MainWindow.xaml.cs
with MIT License
from Actipro

private void applicationOptionsCommand_Execute(object sender, ExecutedRoutedEventArgs e) {
			MessageBox.Show("Show the application options dialog here.");
		}

19 Source : MainWindow.xaml.cs
with MIT License
from Actipro

private void coverPageCommand_Execute(object sender, ExecutedRoutedEventArgs e) {
			MessageBox.Show("Add a cover page here.");
		}

19 Source : MainControl.xaml.cs
with MIT License
from Actipro

private void OnOpenStandardLibraryButtonClick(object sender, RoutedEventArgs e) {
			// Show a file open dialog
			OpenFileDialog dialog = new OpenFileDialog();
			if (!BrowserInteropHelper.IsBrowserHosted) {
				dialog.CheckFileExists = true;
				dialog.replacedle = "Select a file from the Lib folder of your Python standard library";
			}
			dialog.Multiselect = false;
			dialog.Filter = "Python files (*.py)|*.py|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				try {
					var directoryPath = Path.GetDirectoryName(dialog.FileName);
					if (Directory.Exists(directoryPath)) {
						// Add the containing directory as a search path
						var project = codeEditor.Doreplacedent.Language.GetProject();
						project.SearchPaths.Clear();
						project.SearchPaths.Add(directoryPath);

						// Add the site-packages child folder, if present
						var sitePackagesPath = Path.Combine(directoryPath, "site-packages");
						if (Directory.Exists(sitePackagesPath))
							project.SearchPaths.Add(sitePackagesPath);

						MessageBox.Show("Standard library location set to '" + directoryPath + "'.");
					}
				}
				catch (ArgumentException) {}
				catch (IOException) {}
				catch (SecurityException) {}
			}
		}

19 Source : MainControl.xaml.cs
with MIT License
from Actipro

private void OnFileExitMenuItemClick(object sender, RoutedEventArgs e) {
			// Show a message
			MessageBox.Show("Close the application here.");
		}

19 Source : MainControl.xaml.cs
with MIT License
from Actipro

private static void OnSaveExecuted(object sender, ExecutedRoutedEventArgs e) {
			MainControl control = (MainControl)sender;

			// NOTE: Save the doreplacedent here
			MessageBox.Show("Save the doreplacedent here.");

			// Flag as not modified
			control.editor.Doreplacedent.IsModified = false;
		}

19 Source : MainControl.xaml.cs
with MIT License
from Actipro

private void OnGoToLineButtonClick(object sender, RoutedEventArgs e) {
			// Validate
			int lineIndex;
			if ((!int.TryParse(lineNumberTextBox.Text, out lineIndex)) || (lineIndex < 1) || (lineIndex > editor.ActiveView.CurrentSnapshot.Lines.Count)) {
				MessageBox.Show(String.Format("Please enter a valid line number (1-{0}).", editor.ActiveView.CurrentSnapshot.Lines.Count));
				return;
			}

			// Set caret position (make zero-based)
			editor.ActiveView.Selection.CaretPosition = new TextPosition(lineIndex - 1, 0);
			editor.ActiveView.Scroller.ScrollLineToVisibleMiddle();

			// Focus the editor
			editor.Focus();
		}

19 Source : TextDocumentWindow.xaml.cs
with MIT License
from Actipro

private void OnSaveExecuted(object sender, ExecutedRoutedEventArgs e) {
			MessageBox.Show("Save file here.");
		}

19 Source : StartPage.cs
with MIT License
from Actipro

protected override void OnUnselecting(WizardSelectedPageChangeEventArgs e) {
			// Call the base method
			base.OnUnselecting(e);

			// Get the repeat count
			TextBox repeatCountTextbox = (TextBox)this.FindName("PART_RepeatCountTextBox");
			if (repeatCountTextbox != null) {
				int repeatCount;
				if ((int.TryParse(repeatCountTextbox.Text, out repeatCount)) && (repeatCount > 0) && (repeatCount <= 10)) {
					// Place an ItemStore in the Wizard's Tag 
					ItemStore store = (ItemStore)this.Wizard.Tag;
					if ((store == null) || (store.Items.Count != repeatCount)) {
						store = new ItemStore();
						for (int index = 0; index < repeatCount; index++) {
							Item item = new Item();
							item.Index = index + 1;
							store.Items.Add(item);
						}
						this.Wizard.Tag = store;
					}
					return;
				}

				MessageBox.Show("Please enter a number between 1 and 10.");
			}
			
			e.Handled = true;
			e.Cancel = true;
		}

19 Source : MainWindow.xaml.cs
with GNU General Public License v2.0
from adrifcastr

public void readxml()
        {
            statuslabel.Content = "Reading XML File...";

            string xmldir = AppDomain.CurrentDomain.BaseDirectory + @"\\tmp";
            string[] xmlfile = Directory.GetFiles(xmldir, "*.xml");

            if (xmlfile.Length != 1)
            {
                System.Windows.MessageBox.Show("There is no file to patch within your NSP file!");
                return;
            }

            XDoreplacedent xdoc = XDoreplacedent.Load(xmlfile[0]);
            foreach (var order in xdoc.Descendants("ContentMeta"))
            {
                string mrmk = order.Element("KeyGenerationMin").Value;
                {
                    keylabel.Content = mrmk;
                }

                string tid = order.Element("Id").Value;
                {
                    tidlabel.Content = tid.Substring(2);
                }
            }

            if (keylabel.Content.Equals(null))
            {
                fwlabel.Content = "???";

                DialogResult uspg = System.Windows.Forms.MessageBox.Show("This NSP is not supported!",
                "Error", MessageBoxButtons.OK,
                MessageBoxIcon.Error);

                if (uspg == System.Windows.Forms.DialogResult.OK)
                    return;
            }

            if (keylabel.Content.Equals("0"))
            {
                fwlabel.Content = "all";
            }

            if (keylabel.Content.Equals("1"))
            {
                fwlabel.Content = "1.0.0";
            }

            if (keylabel.Content.Equals("2"))
            {
                fwlabel.Content = "3.0.0";
            }

            if (keylabel.Content.Equals("3"))
            {
                fwlabel.Content = "3.0.1";
            }

            if (keylabel.Content.Equals("4"))
            {
                fwlabel.Content = "4.0.0";
            }

            if (keylabel.Content.Equals("5"))
            {
                fwlabel.Content = "5.0.0";
            }

            if (keylabel.Content.Equals("6"))
            {
                fwlabel.Content = "???";

                DialogResult uspg = System.Windows.Forms.MessageBox.Show("This NSP is not supported yet!",
              "Error", MessageBoxButtons.OK,
               MessageBoxIcon.Error);

              if (uspg == System.Windows.Forms.DialogResult.OK)
              return;
            }
             
            patchxml();
        }

19 Source : MainWindow.xaml.cs
with GNU General Public License v2.0
from adrifcastr

public async void applyupdate()
        {
            statuslabel.Content = "Merging NCA's...";

            string curdir = AppDomain.CurrentDomain.BaseDirectory;
            string tmpdir = AppDomain.CurrentDomain.BaseDirectory + "\\tmp";
            string upddir = AppDomain.CurrentDomain.BaseDirectory + "\\upd";
            string nspudir = AppDomain.CurrentDomain.BaseDirectory + "\\hactool.exe";
            string basenca = tmpdir + "\\NCAID_PLAIN.nca";

            var di = new DirectoryInfo(upddir);
            var result = di.GetFiles().OrderByDescending(x => x.Length).Take(1).ToList();
            var larupdnca = di.GetFiles().OrderByDescending(x => x.Length).Take(1).Select(x => x.FullName).ToList();

            string updnca = String.Join(" ", larupdnca);

            string replacedlkeyp = updreplacedlkyinput.Text;
            string upgtk = new string(replacedlkeyp.Where(c => char.IsLetter(c) || char.IsDigit(c)).ToArray());

            string arg1 = @"-k keys.txt " + "--replacedlekey=" + upgtk + " --basenca=" + basenca + " --section1=" + curdir + "\\romfs.bin" + " --exefsdir=";
            string arg2 = tmpdir + "\\exefs " + updnca;
            string arg = arg1 + arg2; 

            Process aplupd = new Process();
            aplupd.StartInfo.FileName = nspudir;
            aplupd.StartInfo.Arguments = arg;
            aplupd.StartInfo.CreateNoWindow = true;
            aplupd.StartInfo.UseShellExecute = false;
            aplupd.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
            aplupd.EnableRaisingEvents = true;

            aplupd.Start();

            await Task.Run(() => aplupd.WaitForExit());

            aplupd.Close();

            stopbar();

            statuslabel.Content = "";

            Directory.Delete(AppDomain.CurrentDomain.BaseDirectory + @"\\tmp", true);
            Directory.Delete(AppDomain.CurrentDomain.BaseDirectory + @"\\upd", true);

            onbtn();

            System.Windows.MessageBox.Show("Update applyment finished.\nYou can now use your updated romFS via fs-mitm.");
        }

19 Source : MainWindow.xaml.cs
with GNU General Public License v2.0
from adrifcastr

private void Button_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("OSAC" + "\nVersion: 3.0" + "\nDeveloped by: adrifcastr" +
                "\n" + "\nThanks to:" + "\nEvan#8119" + "\nSylveon#8666" + "\njbodan");
        }

See More Examples