System.Windows.MessageBox.Show(System.Windows.Window, string)

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

1160 Examples 7

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void InitializeDialogEditorButtonCommands() {
			editablePathEditor.ButtonCommand = new DelegateCommand<object>(p => {
				var propertyModel = p as IPropertyModel;
				if (propertyModel != null) {
					// Show a file open dialog
					var dialog = new OpenFileDialog();
					dialog.replacedle = "Select the file path";
					if (dialog.ShowDialog() == true) {
						// Update the property value
						propertyModel.Value = dialog.FileName;
					}
				}
			});

			readOnlyPathEditor.ButtonCommand = new DelegateCommand<object>(p => {
				var propertyModel = p as IPropertyModel;
				if (propertyModel != null) {
					// Show the path
					MessageBox.Show(propertyModel.Valuereplacedtring, "Property Value");
				}
			});

			uneditablePathEditor.ButtonCommand = editablePathEditor.ButtonCommand;
		}

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private BitmapSource CreateBitmap(LinearBarCodeSymbology symbology) {
			// Validate the value
			var result = symbology.ValidateValue(this.Value);
			if (!result.IsValid) {
				MessageBox.Show(result.ErrorContent.ToString());
				return null;
			}

			// Build the bar code
			symbology.ValueDisplayStyle = this.ValueDisplayStyle;
			symbology.Value = this.Value;
			return symbology.ToBitmap(96, 96);
		}

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : Actipro

private void fileOpenCommand_Execute(object sender, ExecutedRoutedEventArgs e) {
			if (e.Parameter is IDoreplacedentReference) {
				// Process recent doreplacedent clicks
				MessageBox.Show("Open doreplacedent '" + ((IDoreplacedentReference)e.Parameter).Name + "' here.", "Open Recent Doreplacedent", MessageBoxButton.OK, MessageBoxImage.Information);
				return;
			}

			// Open a doreplacedent
			OpenFileDialog dialog = new OpenFileDialog();
			dialog.DefaultExt = ".rtf";
			dialog.CheckFileExists = true;
			dialog.Filter = "Doreplacedent Files (*.rtf; *.txt)|*.rtf;*.txt|Rich Text Files (*.rtf)|*.rtf|Text Files (*.txt)|*.txt";
			if (dialog.ShowDialog() == true)
				this.CurrentDoreplacedentData = new DoreplacedentData(dialog.FileName);
		}

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : Actipro

private void findCommand_Execute(object sender, ExecutedRoutedEventArgs e) {
			IValueCommandParameter parameter = e.Parameter as IValueCommandParameter;
			if (parameter != null) {
				parameter.Handled = true;
				MessageBox.Show("Implement text search for '" + parameter.Value + "' here.");
			}
		}

19 View Source File : RichTextBoxExtended.cs
License : MIT License
Project Creator : Actipro

private void OnFontSizeExecute(object sender, ExecutedRoutedEventArgs e) {
			DoubleValueCommandParameter parameter = e.Parameter as DoubleValueCommandParameter;
			if (parameter != null) {
				if (parameter.ConversionException != null)
					MessageBox.Show(parameter.ConversionException.Message, "Invalid Font Size", MessageBoxButton.OK, MessageBoxImage.Exclamation);
				else {
					switch (parameter.Action) {
						case ValueCommandParameterAction.CancelPreview:
							this.DeactivatePreviewMode(true);
							break;
						case ValueCommandParameterAction.Commit:
							this.DeactivatePreviewMode(false);
							this.SelectionFontSize = parameter.Value;
							break;
						case ValueCommandParameterAction.Preview:
							this.ActivatePreviewMode();
							this.SelectionFontSize = parameter.PreviewValue;
							break;
					}
				}
				e.Handled = true;
			}
		}

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnOpenExecute(object sender, ExecutedRoutedEventArgs e) {
			if (e.Parameter is IDoreplacedentReference) {
				// Process recent doreplacedent clicks
				MessageBox.Show("Open doreplacedent '" + ((IDoreplacedentReference)e.Parameter).Name + "' here.", "Open Recent Doreplacedent", MessageBoxButton.OK, MessageBoxImage.Information);
				return;
			}
		}

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnOpenExecute(object sender, ExecutedRoutedEventArgs e) {
			if (e.Parameter is IDoreplacedentReference) {
				// Process recent doreplacedent clicks
				MessageBox.Show("Open doreplacedent '" + ((IDoreplacedentReference)e.Parameter).Name + "' here.", "Open Recent Doreplacedent", MessageBoxButton.OK, MessageBoxImage.Information);
				return;
			}

			// Show the open file dialog
			OpenFileDialog dialog = new OpenFileDialog();
			dialog.CheckFileExists = true;
			dialog.Filter = "All Files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				// Add a new doreplacedent reference to the recent doreplacedent manager by calling the helper notify method...
				//   Alternatively you could create a DoreplacedentReference and add it to recentDocManager.Doreplacedents manually
				//   but the benefit of this helper is that it checks for an existing Uri match so that you don't add duplicates
				recentDocManager.NotifyDoreplacedentOpened(new Uri(dialog.FileName));
			}

		}

19 View Source File : CodeLensAdornmentManager.cs
License : MIT License
Project Creator : Actipro

protected override void AddAdornment(ITextViewLine viewLine, TagSnapshotRange<CodeLensTag> tagRange) {
			if (tagRange.Tag.Declaration.AstNode == null)
				return;

			// Build the text
			string text = null;
			switch (tagRange.Tag.Declaration.AstNode.Id) {
				case AstImpl.DotNetAstNodeId.ClreplacedDeclaration:
					text = "clreplaced ";
					break;
				case AstImpl.DotNetAstNodeId.DelegateDeclaration:
					text = "delegate ";
					break;
				case AstImpl.DotNetAstNodeId.EnumerationDeclaration:
					text = "enum ";
					break;
				case AstImpl.DotNetAstNodeId.InterfaceDeclaration:
					text = "interface ";
					break;
				case AstImpl.DotNetAstNodeId.StructureDeclaration:
					text = "struct ";
					break;
				default:
					return;
			}
			var typeDeclAstNode = (AstImpl.TypeDeclaration)tagRange.Tag.Declaration.AstNode;
			text += typeDeclAstNode.Name.Text;
			
			// Create a link
			var link = new Hyperlink();
			link.Focusable = false;
			link.Foreground = Brushes.Gray;
			link.Inlines.Add("Doreplacedentation");
			link.Click += (e, s) => {
				MessageBox.Show("Show " + typeDeclAstNode.Name.Text + " doreplacedentation here.");
			};

			// Create the text block
			var textBlock = new TextBlock();
			textBlock.Foreground = Brushes.Gray;
			textBlock.FontFamily = new FontFamily("Segoe UI");
			textBlock.FontSize = 10;
			textBlock.Inlines.Add(text + " - ");
			textBlock.Inlines.Add(link);
			textBlock.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

			// Determine the adornment location
			var charBounds = viewLine.GetCharacterBounds(tagRange.SnapshotRange.StartOffset);
			var location = new Point(charBounds.Left, charBounds.Top - viewLine.TopMargin + ((viewLine.TopMargin - textBlock.DesiredSize.Height) / 2.0));

			// Add the adornment
			this.AdornmentLayer.AddAdornment(AdornmentChangeReason.Other, textBlock, location, tagRange.Tag.Key, null);
		}

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : Actipro

private void wizard_Cancel(object sender, RoutedEventArgs e) {
			if ((BrowserInteropHelper.IsBrowserHosted) || (!wizard.CancelButtonClosesWindow))
				MessageBox.Show("You clicked the Cancel button while on the '" + wizard.SelectedPage.Caption + "' page.", "Wizard Sample");
		}

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : Actipro

private void wizard_Finish(object sender, RoutedEventArgs e) {
			if ((BrowserInteropHelper.IsBrowserHosted) || (!wizard.FinishButtonClosesWindow))
				MessageBox.Show("You clicked the Finish button while on the '" + wizard.SelectedPage.Caption + "' page.", "Wizard Sample");
		}

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : Actipro

private void wizard_Help(object sender, RoutedEventArgs e) {
			MessageBox.Show("You clicked the Help button while on the '" + wizard.SelectedPage.Caption + "' page.", "Wizard Sample");
		}

19 View Source File : SuppressDiagnosticCommandBase.cs
License : GNU General Public License v3.0
Project Creator : Acumatica

protected virtual Task SuppressDiagnosticsAsync(List<DiagnosticData> diagnosticData, Doreplacedent doreplacedent, SyntaxNode syntaxRoot, 
														SemanticModel semanticModel, SyntaxNode nodeWithDiagnostic)
		{
			switch (diagnosticData.Count)
			{
				case 0:
					MessageBox.Show(VSIXResource.DiagnosticSuppression_NoDiagnosticFound, AreplacedinatorVSPackage.PackageName);
					return Task.CompletedTask;
				case 1:
					return SuppressSingleDiagnosticOnNodeAsync(diagnosticData[0], doreplacedent, syntaxRoot, semanticModel, nodeWithDiagnostic);
				default:
					return SupressMultipleDiagnosticOnNodeAsync(diagnosticData, doreplacedent, syntaxRoot, semanticModel, nodeWithDiagnostic);
			}
		}

private void ShowErrorMessage(TextDoreplacedent suppressionFile, Project project)
		{
			LocalizableResourceString errorMessage;

			if (suppressionFile?.FilePath != null)
			{
				errorMessage = new LocalizableResourceString(nameof(Resources.DiagnosticSuppression_FailedToAddToSuppressionFile),
															 Resources.ResourceManager, typeof(Resources), suppressionFile.FilePath);
			}
			else
			{
				errorMessage = new LocalizableResourceString(nameof(Resources.DiagnosticSuppression_FailedToFindSuppressionFile),
															 Resources.ResourceManager, typeof(Resources), project.replacedemblyName);
			}

			MessageBox.Show(errorMessage.ToString(), AreplacedinatorVSPackage.PackageName);
		}

protected override Task SupressMultipleDiagnosticOnNodeAsync(List<DiagnosticData> diagnosticData, Doreplacedent doreplacedent, SyntaxNode syntaxRoot,
																	 SemanticModel semanticModel, SyntaxNode nodeWithDiagnostic)
		{
			MessageBox.Show(VSIXResource.DiagnosticSuppression_MultipleDiagnosticFound, AreplacedinatorVSPackage.PackageName);
			return Task.CompletedTask;
		}

19 View Source File : VsixIOErrorProcessor.cs
License : GNU General Public License v3.0
Project Creator : Acumatica

public void ProcessError(Exception exception, [CallerMemberName]string reportedFrom = null)
		{
			exception.ThrowOnNull(nameof(exception));

			string errorMsg = Resources.FailedToLoadTheSuppressionFile + Environment.NewLine + Environment.NewLine +
							  string.Format(Resources.FailedToLoadTheSuppressionFileDetails, Environment.NewLine + exception.Message);

			MessageBox.Show(errorMsg, AreplacedinatorVSPackage.PackageName, MessageBoxButton.OK, MessageBoxImage.Error);
			AreplacedinatorVSPackage.Instance.AreplacedinatorLogger?.LogException(exception, logOnlyFromAreplacedinatorreplacedemblies: false,
																		Logger.LogMode.Warning, reportedFrom);
		}

19 View Source File : ConnectionDialogViewModel.cs
License : BSD 2-Clause "Simplified" License
Project Creator : adospace

bool TestConnection(bool showSuccedMessage = true)
        {
            try
            {
                var cs = new ConnectionString()
                {
                    Filename = Filename,
                    Connection = this.Mode,
                    InitialSize = InitialSize,
                    Preplacedword = Preplacedword,
                    ReadOnly = ReadOnly,
                    Upgrade = Upgrade
                };

                using (var db = new LiteDatabase(cs))
                    db.GetCollectionNames();

                if (showSuccedMessage)
                    MessageBox.Show("Test succeed!", "LiteDB Connection");

                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(View, [email protected]"Unable to open database, please check connection settings and try again.
Exception:
{ex}", "LiteDB Connection");
            }

            return false;
        }

19 View Source File : ConnectionDialogViewModel.cs
License : BSD 2-Clause "Simplified" License
Project Creator : adospace

bool TestConnection(bool showSuccedMessage = true)
        {
            try
            {
                var cs = new ConnectionString(Filename)
                {
                    CacheSize = CacheSize,
                    InitialSize = InitialSize,
                    Journal = Journal,
                    LimitSize = LimitSize,
                    Mode = Mode,
                    Preplacedword = Preplacedword
                };

                using (var db = new LiteDatabase(cs))
                    db.GetCollectionNames();

                if (showSuccedMessage)
                    MessageBox.Show("Test succeed!", "LiteDB Connection");

                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(View, [email protected]"Unable to open database, please check connection settings and try again.
Exception:
{ex}", "LiteDB Connection");
            }

            return false;
        }

19 View Source File : MainWindow.xaml.cs
License : GNU General Public License v2.0
Project Creator : adrifcastr

public async void repacknsp()
        {
            statuslabel.Content = "Repacking NSP Container...";

            string nspbdir = AppDomain.CurrentDomain.BaseDirectory + "\\nspBuild.pyw";
            string[] tmpfiles = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory + @"\\tmp");
            string args = String.Join(" ", tmpfiles);

            Process nsb = new Process();
            nsb.StartInfo.FileName = nspbdir;
            nsb.StartInfo.Arguments = args;
            nsb.StartInfo.CreateNoWindow = true;
            nsb.StartInfo.UseShellExecute = true;
            nsb.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
            nsb.EnableRaisingEvents = true;

            nsb.Start();

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

            nsb.Close(); 

            stopbar();

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

            System.Windows.MessageBox.Show("Congrats this NSP will now work on " + fwlabel.Content + "!");

            statuslabel.Content = "";
            keylabel.Content = "";
            fwlabel.Content = "";
            tidlabel.Content = "";

            onbtn();
        }

19 View Source File : FileExplorerViewModel.cs
License : MIT License
Project Creator : afxw

private void HandleNotifyStatus(IPacket packet)
        {
            var statusPacket = (NotifyStatusPacket)packet;
            MessageBox.Show(statusPacket.StatusMessage, "Notification", MessageBoxButton.OK, MessageBoxImage.Information);
        }

19 View Source File : DataModelDesignModel.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu

void VerifyAccessToken()
        {
            try
            {
                SelecTesreplacedem.RequestId = RandomOperate.Generate(8);
                GlobalContext.SetRequestContext(ZeroApplication.Config.ServiceKey, SelecTesreplacedem.RequestId);
                var client = new ApiClient
                {
                    Station = "Auth",
                    Commmand = "v1/verify/at",
                    Argument = JsonConvert.SerializeObject(new
                    {
                        Token = User.AccessToken
                    })
                };
                client.CallCommand();
                SelecTesreplacedem.GlobalId = client.GlobalId;
                var result = JsonConvert.DeserializeObject<ApiResult<LoginUserInfo>>(client.Result);
                if (!result.Success)
                {
                    MessageBox.Show(result.Status?.ClientMessage, "校验AT", MessageBoxButton.OK,
                        MessageBoxImage.Error);
                    return;
                }
                User.Customer = result.ResultData;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "校验AT", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }

19 View Source File : DataModelDesignModel.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu

void Login()
        {
            try
            {
                SelecTesreplacedem.RequestId = RandomOperate.Generate(8);
                GlobalContext.SetRequestContext(ZeroApplication.Config.ServiceKey, SelecTesreplacedem.RequestId);
                GlobalContext.Customer.DeviceId = User.DeviceId;
                GlobalContext.RequestInfo.Token = User.DeviceId;
                var client = new ApiClient
                {
                    Station = "UserCenter",
                    Commmand = "v1/login/account",
                    Argument = JsonConvert.SerializeObject(new PhoneLoginRequest
                    {
                        MobilePhone = User.UserName,
                        UserPreplacedword = User.PreplacedWord
                    })
                };
                client.CallCommand();
                SelecTesreplacedem.GlobalId = client.GlobalId;
                var result = JsonConvert.DeserializeObject<ApiResult<LoginResponse>>(client.Result);
                if (!result.Success)
                {
                    MessageBox.Show(result.Status?.ClientMessage, "登录", MessageBoxButton.OK,
                        MessageBoxImage.Error);
                    return;
                }
                User.AccessToken = result.ResultData.AccessToken;
                User.RefreshToken = result.ResultData.RefreshToken;
                VerifyAccessToken();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "登录", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }

19 View Source File : DataModelDesignModel.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu

string LoadDeviceId()
        {
            try
            {
                SelecTesreplacedem.RequestId = RandomOperate.Generate(8);
                GlobalContext.SetRequestContext(ZeroApplication.Config.ServiceKey, SelecTesreplacedem.RequestId);
                var client = new ApiClient
                {
                    Station = "UserCenter",
                    Commmand = "v1/refresh/did"
                };
                client.CallCommand();
                SelecTesreplacedem.GlobalId = client.GlobalId;
                var result = JsonConvert.DeserializeObject<ApiResult<string>>(client.Result);
                if (!result.Success)
                {
                    MessageBox.Show(result.Status?.ClientMessage, "获取DeviceId", MessageBoxButton.OK,
                        MessageBoxImage.Error);
                    return null;
                }

                return result.ResultData;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "获取DeviceId", MessageBoxButton.OK, MessageBoxImage.Error);
                return null;
            }
        }

19 View Source File : AsyncCommandItem.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu

private bool DoPrepare(TParameter parameter, Action<TParameter> action)
        {
            if (DoConfirm && 
                MessageBox.Show(ConfirmMessage ?? $"ȷ��ִ�С�{Caption}��������?", "����༭", MessageBoxButton.YesNo) !=
                MessageBoxResult.Yes)
            {
                return false;
            }
            if (OnPrepare != null && !OnPrepare(this))
                return false;

            return DoPrepareInner( parameter, action);
        }

19 View Source File : CommandItem.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu

void DoAction(object arg)
        {
            if (DoConfirm && MessageBox.Show(ConfirmMessage ?? $"ȷ��ִ�С�{Caption ?? Name}��������?", "����༭", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
            {
                return;
            }
            if (OnPrepare == null || OnPrepare(this))
                Action?.Invoke(arg);
        }

19 View Source File : CommandItem.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu

void DoAction()
        {
            if (!string.IsNullOrWhiteSpace(ConfirmMessage) && MessageBox.Show(ConfirmMessage, "����༭", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
            {
                return;
            }
            if (OnPrepare == null || OnPrepare(this))
                Action?.Invoke(Argument);
        }

19 View Source File : MainWindow.xaml.cs
License : GNU Affero General Public License v3.0
Project Creator : akshinmustafayev

public void LoadConfig()
        {
            if (File.Exists(ConfigUtils.ConfigJsonPath))
            {
                try
                {
                    string configJson = File.ReadAllText(ConfigUtils.ConfigJsonPath);
                    config = JsonConvert.DeserializeObject<Config>(configJson);

                    MainTab.ItemsSource = ConfigUtils.ConvertTabsFromConfigToUI(config);

                    AddTextToEventsList("Config loaded from file: " + ConfigUtils.ConfigJsonPath, false);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    AddTextToEventsList("Error occured while loading file: " + ex.Message, false);
                }
            }
            else
            {
                MessageBox.Show("File " + ConfigUtils.ConfigJsonPath + " does not exist.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }

19 View Source File : App.xaml.cs
License : MIT License
Project Creator : AlexanderPro

private void OnCurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            var exception = e.ExceptionObject as Exception;
            exception = exception ?? new Exception("OnCurrentDomainUnhandledException");
            var message = exception.Message;
            if (exception is Win32Exception)
            {
                message = $"Win32 Error Code = {((Win32Exception)exception).ErrorCode},{Environment.NewLine}{message}";
            }
            MessageBox.Show(message, replacedemblyUtils.replacedemblyProductName, MessageBoxButton.OK, MessageBoxImage.Error);
        }

19 View Source File : WpfMessageBoxService.cs
License : GNU General Public License v3.0
Project Creator : alexdillon

public void ShowMessageBox(MessageBoxParams parameters)
        {
            MessageBox.Show(
                parameters.Message,
                parameters.replacedle,
                this.GetButtons(parameters.MessageBoxButtons),
                this.GetImage(parameters.MessageBoxIcons));
        }

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : alexleen

private async void SaveToFileAsync()
        {
            try
            {
                await ConfigurationXml.SaveAsync();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, $"An unexpected error occurred while saving:{Environment.NewLine}{Environment.NewLine}{ex.Message}", "Unexpected Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : alexleen

private void LoadFromFile(string filename)
        {
            ConfigurationXml = mConfigurationFactory.Create(filename);

            try
            {
                ConfigurationXml.Load();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, $"An unexpected error occurred while loading '{filename}':{Environment.NewLine}{Environment.NewLine}{ex.Message}", "Unexpected Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            xChildren.ItemsSource = ConfigurationXml.Children;
            xAddRefsToMenuItem.ItemsSource = ConfigurationXml.Children.OfType<IAcceptAppenderRef>().Cast<NamedModel>();
            xRightSp.IsEnabled = true;
            xSaveButton.IsEnabled = true;
            xSaveAndCloseButton.IsEnabled = true;
        }

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : alexleen

private void AddRootClick(object sender, RoutedEventArgs e)
        {
            if (xChildren.ItemsSource.Cast<ModelBase>().Any(cm => cm.Node.Name == "root"))
            {
                MessageBox.Show(this, "This configuration already contains a root logger.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            OpenElementWindow(LoggerDescriptor.Root);
        }

19 View Source File : AlertToChartCreateUi.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void SetSettingsForomWindow()
        {
            try
            {
                TextBoxVolumeReaction.Text.ToDecimal();
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Alerts.Message3);
            }

            if (MyAlert == null)
            {
                return;
            }

            
            MyAlert.IsMusicOn = CheckBoxMusicAlert.IsChecked.Value;
            MyAlert.IsOn = CheckBoxOnOff.IsChecked.Value;
            MyAlert.IsMessageOn = CheckBoxWindow.IsChecked.Value;

            MyAlert.Label = TextBoxLabelAlert.Text;
          //  MyAlert.ColorLabel = HostColorLabel.Child.BackColor;

           // MyAlert.ColorLine = HostColorLine.Child.BackColor;
            MyAlert.BorderWidth = Convert.ToInt32(ComboBoxFatLine.SelectedItem);

            MyAlert.Message = TextBoxAlertMessage.Text;

            Enum.TryParse(ComboBoxType.Text, true, out MyAlert.Type);

            Enum.TryParse(ComboBoxSignalType.Text, true, out MyAlert.SignalType);
            MyAlert.VolumeReaction = TextBoxVolumeReaction.Text.ToDecimal();

            MyAlert.Slippage = Convert.ToDecimal(TextBoxSlippage.Text);
            MyAlert.NumberClosePosition = Convert.ToInt32(TextBoxClosePosition.Text);
            Enum.TryParse(ComboBoxOrderType.Text, true, out MyAlert.OrderPriceType);

            Enum.TryParse(ComboBoxMusicType.Text,out MyAlert.Music);


            System.Windows.Media.Color  labelColor = ((SolidColorBrush)ButtonColorLabel.Background).Color;
            MyAlert.ColorLabel = System.Drawing.Color.FromArgb(labelColor.A, labelColor.R, labelColor.G, labelColor.B);

            System.Windows.Media.Color lineColor = ((SolidColorBrush)ButtonColorLine.Background).Color;
            MyAlert.ColorLine = System.Drawing.Color.FromArgb(lineColor.A, lineColor.R, lineColor.G, lineColor.B);


        }

19 View Source File : AlertMaster.cs
License : Apache License 2.0
Project Creator : AlexWan

public void ShowAlertNewDialog(AlertType type)
        {
            try
            {
                if (type == AlertType.ChartAlert)
                {
                    if (_alertChartUi != null)
                    {
                        MessageBox.Show(OsLocalization.Alerts.Message1);
                        return;
                    }

                    _alertChartUi = new AlertToChartCreateUi(null, this);

                    if (_alertChartUi != null)
                    {
                        _alertChartUi.Closing += _ChartAertUi_Closing;
                        _alertChartUi.Show();
                    }
                }

                if (type == AlertType.PriceAlert)
                {
                    int num = 0;

                    if (_alertArray != null)
                    {
                        num = _alertArray.Count;
                    }

                    AlertToPrice newPriceAlert = new AlertToPrice(_name + num);

                    newPriceAlert.ShowDialog();

                    SetNewAlert(newPriceAlert);
                }
            }
            catch (Exception error)
            {
                SendNewMessage(error.ToString(), LogMessageType.Error);
            }
        }

19 View Source File : AlertMaster.cs
License : Apache License 2.0
Project Creator : AlexWan

public void ShowAlertRedactDialog(int number)
        {
            try
            {
                if (_alertChartUi != null)
                {
                    MessageBox.Show(OsLocalization.Alerts.Message1);
                    return;
                }


                if (number > _alertArray.Count || _alertArray.Count == 0)
                {
                    return;
                }
                if (_alertArray[number].TypeAlert == AlertType.ChartAlert)
                {
                    _alertChartUi = new AlertToChartCreateUi((AlertToChart)_alertArray[number], this);
                    _alertChartUi.Closing += _ChartAertUi_Closing;
                    _alertChartUi.Show();
                }
                if (_alertArray[number].TypeAlert == AlertType.PriceAlert)
                {
                   ((AlertToPrice)_alertArray[number]).ShowDialog();
                }
            }
            catch (Exception error)
            {
                SendNewMessage(error.ToString(), LogMessageType.Error);
            }
        }

19 View Source File : ProxyHolderAddUi.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void ButtonSave_Click(object sender, RoutedEventArgs e)
        {

            if (string.IsNullOrWhiteSpace(TextBoxIP.Text) ||
                string.IsNullOrWhiteSpace(TextBoxName.Text) ||
                string.IsNullOrWhiteSpace(TextBoxPreplacedword.Text))
            {
                MessageBox.Show(OsLocalization.Enreplacedy.ErrorSave);
                return;
            }

            Proxy = new ProxyHolder();

            Proxy.Ip = TextBoxIP.Text;
            Proxy.UserName = TextBoxName.Text;
            Proxy.UserPreplacedword = TextBoxPreplacedword.Text;

            Close();
            ButtonSave.Content = OsLocalization.Enreplacedy.ProxiesLabel3;
            replacedle = OsLocalization.Enreplacedy.replacedleProxyAddUi;
        }

19 View Source File : SecurityUi.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            decimal go;
            decimal lot;
            decimal step;
            decimal stepCost;

            try
            {
                go = TextBoxGoPersent.Text.ToDecimal();
                lot = TextBoxLot.Text.ToDecimal();
                step = TextBoxStep.Text.ToDecimal();
                stepCost = TextBoxStepCost.Text.ToDecimal();

            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Enreplacedy.ErrorSave);
                return;
            }

            if (go < 1 || go > 100)
            {
                MessageBox.Show(OsLocalization.Enreplacedy.ErrorSave);
                return;
            }

            _security.Go = go/100;
            _security.Lot = lot;
            _security.PriceStep = step;
            _security.PriceStepCost = stepCost;
            IsChanged = true;
            Close();
        }

19 View Source File : OsMinerSetUi.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(TextBoxSetName.Text))
            {
                MessageBox.Show(OsLocalization.Miner.Label2);
                return;
            }
            IsActivate = true;
            _set.Name = TextBoxSetName.Text;
            Close();
        }

19 View Source File : OptimizerMaster.cs
License : Apache License 2.0
Project Creator : AlexWan

private bool CheckReadyData()
        {
            if (Fazes == null || Fazes.Count == 0)
            {
                MessageBox.Show(OsLocalization.Optimizer.Message14);
                SendLogMessage(OsLocalization.Optimizer.Message14, LogMessageType.System);
                if (NeadToMoveUiToEvent != null)
                {
                    NeadToMoveUiToEvent(NeadToMoveUiTo.Fazes);
                }
                return false;
            }


            if (TabsSimpleNamesAndTimeFrames == null ||
                TabsSimpleNamesAndTimeFrames.Count == 0)
            {
                MessageBox.Show(OsLocalization.Optimizer.Message15);
                SendLogMessage(OsLocalization.Optimizer.Message15, LogMessageType.System);
                if (NeadToMoveUiToEvent != null)
                {
                    NeadToMoveUiToEvent(NeadToMoveUiTo.TabsAndTimeFrames);
                }
                return false;
            }

            if (string.IsNullOrEmpty(Storage.ActiveSet) ||
                Storage.SecuritiesTester == null ||
                Storage.SecuritiesTester.Count == 0)
            {
                MessageBox.Show(OsLocalization.Optimizer.Message16);
                SendLogMessage(OsLocalization.Optimizer.Message16, LogMessageType.System);

                if (NeadToMoveUiToEvent != null)
                {
                    NeadToMoveUiToEvent(NeadToMoveUiTo.Storage);
                }
                return false;
            }

            if (string.IsNullOrEmpty(_strategyName))
            {
                MessageBox.Show(OsLocalization.Optimizer.Message17);
                SendLogMessage(OsLocalization.Optimizer.Message17, LogMessageType.System);
                if (NeadToMoveUiToEvent != null)
                {
                    NeadToMoveUiToEvent(NeadToMoveUiTo.NameStrategy);
                }
                return false;
            }

            bool onParamesReady = false;

            for (int i = 0; i < _paramOn.Count; i++)
            {
                if (_paramOn[i])
                {
                    onParamesReady = true;
                    break;
                }
            }

            if (onParamesReady == false)
            {
                MessageBox.Show(OsLocalization.Optimizer.Message18);
                SendLogMessage(OsLocalization.Optimizer.Message18, LogMessageType.System);
                if (NeadToMoveUiToEvent != null)
                {
                    NeadToMoveUiToEvent(NeadToMoveUiTo.Parametrs);
                }
                return false;
            }


            // проверка наличия и состояния параметра Regime 
            bool onRgimeOff = false;

            for (int i = 0; i < _parameters.Count; i++)
            {
                if (_parameters[i].Name == "Regime")
                {
                    if (((StrategyParameterString)_parameters[i]).ValueString == "Off")
                    {
                        onRgimeOff = true;
                    }
                }
            }

            if (onRgimeOff == true)
            {
                MessageBox.Show(OsLocalization.Optimizer.Message41);
                SendLogMessage(OsLocalization.Optimizer.Message41, LogMessageType.System);
                if (NeadToMoveUiToEvent != null)
                {
                    NeadToMoveUiToEvent(NeadToMoveUiTo.RegimeRow);
                }
                return false;
            }
            // Regime / конец

            return true;
        }

19 View Source File : TesterUi.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void buttonSellFast_Click(object sender, RoutedEventArgs e)
        {
            decimal volume;
            try
            {
                volume = TextBoxVolumeFast.Text.ToDecimal();
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label49);
                return;
            }
            _strategyKeeper.BotSellMarket(volume);
        }

19 View Source File : TesterUi.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void ButtonBuyLimit_Click(object sender, RoutedEventArgs e)
        {
           decimal volume;
            try
            {
                volume = TextBoxVolumeFast.Text.ToDecimal();
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label49);
                return;
            }

            decimal price;

            try
            {
                price = TextBoxPrice.Text.ToDecimal();
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label50);
                  return;
            }
            
            if (price == 0)
            {
                MessageBox.Show(OsLocalization.Trader.Label50);
                return;
            }

            _strategyKeeper.BotBuyLimit(volume,price);
        }

19 View Source File : TesterUi.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void ButtonSellLimit_Click(object sender, RoutedEventArgs e)
        {
            decimal volume;
            try
            {
                volume = TextBoxVolumeFast.Text.ToDecimal();
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label49);
                return;
            }

            decimal price;

            try
            {
                price = TextBoxPrice.Text.ToDecimal();
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label50);
                return;
            }

            if (price == 0)
            {
                MessageBox.Show(OsLocalization.Trader.Label50);
                return;
            }

            _strategyKeeper.BotSellLimit(volume, price);
        }

19 View Source File : BotManualControlUi.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxSecondToOpen.Text) <= 0 ||
                    Convert.ToInt32(TextBoxSecondToClose.Text) <= 0 ||
                    TextBoxStopPercentLenght.Text.ToDecimal() <= 0 ||
                    TextBoxSlipageStop.Text.ToDecimal() <= 0 ||
                    TextBoxProfitPercentLenght.Text.ToDecimal() <= 0 ||
                    TextBoxSlipageProfit.Text.ToDecimal() <= 0 ||
                    TextBoxSetbackToClose.Text.ToDecimal() <= 0 ||
                    Convert.ToInt32(TextBoxSecondToOpen.Text) <= 0 ||
                    TextBoxSetbackToOpen.Text.ToDecimal() <= 0 ||
                    TextBoxSlipageDoubleExit.Text.ToDecimal() < -100)
                {
                    throw new Exception();
                }
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label13);
                return;
            }

            try
            {
                // stop
                // стоп
                _strategySettings.StopIsOn = CheckBoxStopIsOn.IsChecked.Value;
                _strategySettings.StopDistance = TextBoxStopPercentLenght.Text.ToDecimal();
                _strategySettings.StopSlipage =TextBoxSlipageStop.Text.ToDecimal();

                // profit
                // профит
                _strategySettings.ProfitIsOn = CheckBoxProfitIsOn.IsChecked.Value;
                _strategySettings.ProfitDistance = TextBoxProfitPercentLenght.Text.ToDecimal();
                _strategySettings.ProfitSlipage = TextBoxSlipageProfit.Text.ToDecimal();

                // closing position
                // закрытие позиции

                if (CheckBoxSecondToCloseIsOn.IsChecked.HasValue)
                {
                    _strategySettings.SecondToCloseIsOn = CheckBoxSecondToCloseIsOn.IsChecked.Value;
                }
                _strategySettings.SecondToClose = new TimeSpan(0, 0, 0, Convert.ToInt32(TextBoxSecondToClose.Text));

                if (CheckBoxSetbackToCloseIsOn.IsChecked.HasValue)
                {
                    _strategySettings.SetbackToCloseIsOn = CheckBoxSetbackToCloseIsOn.IsChecked.Value;
                }
                _strategySettings.SetbackToClosePosition = TextBoxSetbackToClose.Text.ToDecimal();

                if (CheckBoxDoubleExitIsOnIsOn.IsChecked.HasValue)
                {
                    _strategySettings.DoubleExitIsOn = CheckBoxDoubleExitIsOnIsOn.IsChecked.Value;
                }

                Enum.TryParse(ComboBoxTypeDoubleExitOrder.SelectedItem.ToString(),
                    out _strategySettings.TypeDoubleExitOrder);

                _strategySettings.DoubleExitSlipage = TextBoxSlipageDoubleExit.Text.ToDecimal();

                // opening position
                // открытие позиции

                if (CheckBoxSecondToOreplacedOn.IsChecked.HasValue)
                {
                    _strategySettings.SecondToOreplacedOn = CheckBoxSecondToOreplacedOn.IsChecked.Value;
                }
                _strategySettings.SecondToOpen = new TimeSpan(0, 0, 0, Convert.ToInt32(TextBoxSecondToOpen.Text));

                if (CheckBoxSetbackToOreplacedOn.IsChecked.HasValue)
                {
                    _strategySettings.SetbackToOreplacedOn = CheckBoxSetbackToOreplacedOn.IsChecked.Value;
                }
                _strategySettings.SetbackToOpenPosition = TextBoxSetbackToOpen.Text.ToDecimal();

                Enum.TryParse(ComboBoxValuesType.SelectedItem.ToString(), out _strategySettings.ValuesType);

                _strategySettings.Save();
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }

            Close();
        }

19 View Source File : PositionCloseUi.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Price = Convert.ToDecimal(TextBoxPrice.Text);

                Enum.TryParse(ComboBoxOrderType.Text, true, out OpenType);

                IsAccept = true;
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label13);
                return;
            }

            if (OpenType == PositionOpenType.Aceberg)
            {
                try
                {
                    CountAcebertOrder = Convert.ToInt32(TextBoxAcebergOrdersCount.Text);
                }
                catch (Exception)
                {
                    MessageBox.Show(OsLocalization.Trader.Label13);
                    return;
                }
            }


            Close();
        }

19 View Source File : PositionModificateUi.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Price = Convert.ToDecimal(TextBoxPrice.Text);
                Volume = Convert.ToDecimal(TextBoxVolume.Text);

                if (Volume <= 0)
                {
                    throw new Exception();
                }

                Enum.TryParse(ComboBoxOrderType.Text, true, out OpenType);

                Enum.TryParse(ComboBoxSide.Text, true, out Side);
                IsAccept = true;
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label13);
                return;
            }

            if (OpenType == PositionOpenType.Aceberg)
            {
                try
                {
                    CountAcebertOrder = Convert.ToInt32(TextBoxAcebergOrdersCount.Text);
                }
                catch (Exception)
                {
                    MessageBox.Show(OsLocalization.Trader.Label13);
                    return;
                }
            }

            Close();
        }

19 View Source File : PositionOpenUi.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void Button_Click(object sender, RoutedEventArgs e)
        {

            try
            {
                Price = Convert.ToDecimal(TextBoxPrice.Text);
                Volume = Convert.ToDecimal(TextBoxVolume.Text);

                if (Volume <= 0)
                {
                    throw new Exception();
                }

                Enum.TryParse(ComboBoxOrderType.Text, true, out OpenType);

                Enum.TryParse(ComboBoxSide.Text, true, out Side);
                IsAccept = true;
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label13);
                return;
            }

            if (OpenType == PositionOpenType.Aceberg)
            {
                try
                {
                    CountAcebertOrder = Convert.ToInt32(TextBoxAcebergOrdersCount.Text);
                }
                catch (Exception)
                {
                    MessageBox.Show(OsLocalization.Trader.Label13);
                    return;
                }
            }

            Close();
        }

19 View Source File : PositionStopUi.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                PriceOrder = Convert.ToDecimal(TextBoxPriceOrder.Text);
                PriceActivate = Convert.ToDecimal(TextBoxPriceActivation.Text);
                IsAccept = true;
            }
            catch
            {
                MessageBox.Show(OsLocalization.Trader.Label13);
                return;
            }
            Close();
        }

19 View Source File : BotPanelChartUI.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void buttonBuyFast_Click_1(object sender, RoutedEventArgs e)
        {
            if (_panel.ActivTab.GetType().Name != "BotTabSimple")
            {
                return;
            }

            decimal volume;

            try
            {
                volume = TextBoxVolumeFast.Text.ToDecimal();
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label49);
                return;
            }
            ((BotTabSimple)_panel.ActivTab).BuyAtMarket(volume);
        }

19 View Source File : BotPanelChartUI.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void ButtonBuyLimit_Click(object sender, RoutedEventArgs e)
        {
            if (_panel.ActivTab.GetType().Name != "BotTabSimple")
            {
                return;
            }
            decimal volume;
            try
            {
                volume = Decimal.Parse(TextBoxVolumeFast.Text.Replace(",",
                        CultureInfo.InvariantCulture.NumberFormat.NumberDecimalSeparator),
                    CultureInfo.InvariantCulture);
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label49);
                return;
            }

            decimal price;

            try
            {
                price = TextBoxPrice.Text.ToDecimal();
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label50);
                return;
            }

            if (price == 0)
            {
                MessageBox.Show(OsLocalization.Trader.Label50);
                return;
            }
            ((BotTabSimple)_panel.ActivTab).BuyAtLimit(volume, price);

        }

19 View Source File : OsTraderMaster.cs
License : Apache License 2.0
Project Creator : AlexWan

public void BotManualSettingsDialog()
        {
            try
            {
                if (_activPanel == null)
                {
                    MessageBox.Show(OsLocalization.Trader.Label10);
                    return;
                }

                if (_activPanel.ActivTab != null &&
                    _activPanel.ActivTab.GetType().Name == "BotTabSimple")
                {
                    ((BotTabSimple)_activPanel.ActivTab).ShowManualControlDialog();
                }
                else
                {
                    MessageBox.Show(OsLocalization.Trader.Label11);
                }
            }
            catch (Exception error)
            {
                SendNewLogMessage(error.ToString(), LogMessageType.Error);
            }
        }

19 View Source File : StrategyBollingerUi.xaml.cs
License : Apache License 2.0
Project Creator : AlexWan

private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {

                if (Convert.ToDecimal(TextBoxVolumeOne.Text) <= 0 ||
                    Convert.ToDecimal(TextBoxSlipage.Text) < 0)
                {
                    throw new Exception("");
                }
            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label13);
                return;
            }

            _strategy.Volume = Convert.ToDecimal(TextBoxVolumeOne.Text);
            _strategy.Slippage = Convert.ToDecimal(TextBoxSlipage.Text);

            Enum.TryParse(ComboBoxRegime.Text, true, out _strategy.Regime);

            _strategy.Save();
            Close();
        }

See More Examples