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 : LinearRegressionCurveUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenght.Text) <= 0 ||
                    Convert.ToInt32(TextBoxLag.Text) < 0)
                {
                    throw new Exception("error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _lrc.ColorBase = HostColor.Child.BackColor;
            _lrc.Lenght = Convert.ToInt32(TextBoxLenght.Text);
            _lrc.Lag = Convert.ToInt32(TextBoxLag.Text);
            _lrc.PaintOn = CheckBoxPaintOnOff.IsChecked.Value;

            Enum.TryParse(ComboBoxPriceField.SelectedItem.ToString(), true, out _lrc.TypePointsToSearch);

            _lrc.Save();
            IsChange = true;
            Close();
        }

19 Source : MomentumUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenght.Text) <= 0)
                {
                    throw new Exception("error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _momentum.ColorBase = HostColorBase.Child.BackColor;
            _momentum.Nperiod = Convert.ToInt32(TextBoxLenght.Text);
            _momentum.PaintOn = CheckBoxPaintOnOff.IsChecked.Value;
            Enum.TryParse(CandleBox.Text, out _momentum.TypePoint);

            _momentum.Save();

            IsChange = true;
            Close();
        }

19 Source : MoneyFlowIndexUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenght.Text) <= 0)
                {
                    throw new Exception("error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _mfi.ColorBase = HostColorBase.Child.BackColor;
            _mfi.Nperiod = Convert.ToInt32(TextBoxLenght.Text);
            _mfi.PaintOn = CheckBoxPaintOnOff.IsChecked.Value;


            _mfi.Save();

            IsChange = true;
            Close();
        }

19 Source : MovingAverageUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenght.Text) <= 0 ||
                    Convert.ToInt32(TextBoxKaufmanSlow.Text) <= 0 ||
                    Convert.ToInt32(TextBoxKaufmanFast.Text) <= 0)
                {
                    throw new Exception("error");
                }
                Enum.TryParse(ComboBoxMovingType.SelectedItem.ToString(), true, out _mA.TypeCalculationAverage);
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _mA.ColorBase = HostColor.Child.BackColor;
            _mA.Lenght = Convert.ToInt32(TextBoxLenght.Text);
            _mA.PaintOn = CheckBoxPaintOnOff.IsChecked.Value;
            _mA.KaufmanFastEma = Convert.ToInt32(TextBoxKaufmanFast.Text);
            _mA.KaufmanSlowEma = Convert.ToInt32(TextBoxKaufmanSlow.Text);


            ComboBoxMovingType.Items.Add(MovingAverageTypeCalculation.Exponential);
            ComboBoxMovingType.Items.Add(MovingAverageTypeCalculation.Simple);
            Enum.TryParse(ComboBoxMovingType.SelectedItem.ToString(), true, out _mA.TypeCalculationAverage);

            Enum.TryParse(ComboBoxPriceField.SelectedItem.ToString(), true, out _mA.TypePointsToSearch);

            _mA.Save();
            IsChange = true;
            Close();
        }

19 Source : StandardDeviationUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenght.Text) <= 0)
                {
                    throw new Exception("error");
                }
                //Enum.TryParse(ComboBoxMovingType.SelectedItem.ToString(), true, out _mA.TypeCalculationAverage);
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _mA.ColorBase = HostColor.Child.BackColor;
            _mA.Lenght = Convert.ToInt32(TextBoxLenght.Text);
            _mA.PaintOn = CheckBoxPaintOnOff.IsChecked.Value;
            Enum.TryParse(ComboBoxPriceField.SelectedItem.ToString(), true, out _mA.TypePointsToSearch);

            _mA.Save();
            IsChange = true;
            Close();
        }

19 Source : StochasticOscillatorUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenght.Text) <= 0||
                    Convert.ToInt32(TextBoxLenght2.Text) <= 0 ||
                    Convert.ToInt32(TextBoxLenght3.Text) <= 0)
                {
                    throw new Exception("error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _so.ColorUp = HostColor1.Child.BackColor;
            _so.ColorDown = HostColor2.Child.BackColor;

            _so.P1 = Convert.ToInt32(TextBoxLenght.Text);
            _so.P2 = Convert.ToInt32(TextBoxLenght2.Text);
            _so.P3 = Convert.ToInt32(TextBoxLenght3.Text);

            _so.PaintOn = CheckBoxPaintOnOff.IsChecked.Value;

            Enum.TryParse(Movingbox.Text, out _so.TypeCalculationAverage);

            _so.Save();

            IsChange = true;
            Close();
        }

19 Source : StochRsiUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenght.Text) <= 0 ||
                    Convert.ToInt32(TextBoxStochasticLength.Text) <= 0 ||
                    Convert.ToInt32(TextBoxK.Text) <= 0 ||
                    Convert.ToInt32(TextBoxD.Text) <= 0)
                {
                    throw new Exception("error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _rsi.ColorK = HostColor.Child.BackColor;
            _rsi.ColorD = HostColorD.Child.BackColor;
            _rsi.RsiLenght = Convert.ToInt32(TextBoxLenght.Text);
            _rsi.StochasticLength = Convert.ToInt32(TextBoxStochasticLength.Text);
            _rsi.K = Convert.ToInt32(TextBoxK.Text);
            _rsi.D = Convert.ToInt32(TextBoxD.Text);

            _rsi.Save();
            IsChange = true;
            Close();
        }

19 Source : TradeThread.cs
with Apache License 2.0
from AlexWan

public void ShowDialog()
        {
            MessageBox.Show("У данного индикатора нет настроек");
        }

19 Source : TrixUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenght.Text) <= 0)
                {
                    throw new Exception("error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _trix.ColorBase = HostColorBase.Child.BackColor;
            _trix.Period = Convert.ToInt32(TextBoxLenght.Text);
            _trix.PaintOn = CheckBoxPaintOnOff.IsChecked.Value;

            Enum.TryParse(Movingbox.Text, out _trix.TypeCalculationAverage);

            _trix.Save();

            IsChange = true;
            Close();
        }

19 Source : UltimateOscillatorUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenght.Text) <= 0 ||
                     Convert.ToInt32(TextBoxLenght2.Text) <= 0 ||
                      Convert.ToInt32(TextBoxLenght3.Text) <= 0)
                {
                    throw new Exception("error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }


            _indicator.Period2 = Convert.ToInt32(TextBoxLenght2.Text);
            _indicator.Period3 = Convert.ToInt32(TextBoxLenght3.Text);
            _indicator.ColorBase = HostColorBase.Child.BackColor;
            _indicator.Period1 = Convert.ToInt32(TextBoxLenght.Text);
            _indicator.PaintOn = CheckBoxPaintOnOff.IsChecked.Value;

            _indicator.Save();

            IsChange = true;
            Close();
        }

19 Source : CandleManager.cs
with Apache License 2.0
from AlexWan

private void SendLogMessage(string message,LogMessageType type)
        {
            if (LogMessageEvent != null)
            {
                LogMessageEvent(message, type);
            }
            else if (type == LogMessageType.Error)
            {
                MessageBox.Show(message);
            }
        }

19 Source : PriceChannelUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenghtUp.Text) <= 0 ||
                    Convert.ToInt32(TextBoxLenghtDown.Text) <= 0)
                {
                    throw new Exception("error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _bollinger.ColorUp = HostColorUp.Child.BackColor;
            _bollinger.ColorDown = HostColorDown.Child.BackColor;

            _bollinger.LenghtUpLine = Convert.ToInt32(TextBoxLenghtUp.Text);
            _bollinger.LenghtDownLine = Convert.ToInt32(TextBoxLenghtDown.Text);

            if (CheckBoxPaintOnOff.IsChecked.HasValue)
            {
                _bollinger.PaintOn = CheckBoxPaintOnOff.IsChecked.Value;
            }

            _bollinger.Save();
            IsChange = true;
            Close();
        }

19 Source : RocUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenght.Text) <= 0)
                {
                    throw new Exception("error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _roc.ColorBase = HostColorBase.Child.BackColor;
            _roc.Period = Convert.ToInt32(TextBoxLenght.Text);
            _roc.PaintOn = CheckBoxPaintOnOff.IsChecked.Value;
            Enum.TryParse(CandleBox.Text, out _roc.TypePoint);


            _roc.Save();

            IsChange = true;
            Close();
        }

19 Source : RsiUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenght.Text) <= 0)
                {
                    throw new Exception("error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _rsi.ColorBase = HostColor.Child.BackColor;
            _rsi.Lenght = Convert.ToInt32(TextBoxLenght.Text);

            _rsi.Save();
            IsChange = true;
            Close();
        }

19 Source : RviUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenght.Text) <= 0)
                {
                    throw new Exception("error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _rvi.ColorDown = HostColorBase.Child.BackColor;
            _rvi.ColorUp = HostColorBaseCopy.Child.BackColor;
            _rvi.Period = Convert.ToInt32(TextBoxLenght.Text);
            _rvi.PaintOn = CheckBoxPaintOnOff.IsChecked.Value;



            _rvi.Save();

            IsChange = true;
            Close();
        }

19 Source : VerticalHorizontalFilterUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenght.Text) <= 0)
                {
                    throw new Exception("error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _vhf.ColorBase = HostColorBase.Child.BackColor;
            _vhf.Nperiod = Convert.ToInt32(TextBoxLenght.Text);
            _vhf.PaintOn = CheckBoxPaintOnOff.IsChecked.Value;



            _vhf.Save();

            IsChange = true;
            Close();
        }

19 Source : VolumeOscillatorUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if ((Convert.ToInt32(TextBoxLenght1.Text) <= 0) || (Convert.ToInt32(TextBoxLenght2.Text) <= 0))
                {
                    throw new Exception("error");
                }
                //Enum.TryParse(ComboBoxMovingType.SelectedItem.ToString(), true, out _mA.TypeCalculationAverage);
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _mA.ColorBase = HostColor.Child.BackColor;
            _mA.Lenght1 = Convert.ToInt32(TextBoxLenght1.Text);
            _mA.Lenght2 = Convert.ToInt32(TextBoxLenght2.Text);
            _mA.PaintOn = CheckBoxPaintOnOff.IsChecked.Value;
            //Enum.TryParse(ComboBoxPriceField.SelectedItem.ToString(), true, out _mA.TypePointsToSearch);

            _mA.Save();
            IsChange = true;
            Close();
        }

19 Source : WilliamsRangeUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(TextBoxLenght.Text) <= 0)
                {
                    throw new Exception("error");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Процесс сохранения прерван. В одном из полей недопустимые значения");
                return;
            }

            _wr.ColorBase = HostColorBase.Child.BackColor;
            _wr.Nperiod = Convert.ToInt32(TextBoxLenght.Text);
            if (CheckBoxPaintOnOff.IsChecked.HasValue)
            {
                _wr.PaintOn = CheckBoxPaintOnOff.IsChecked.Value;
            }
            

            _wr.Save();

            IsChange = true;
            Close();
        }

19 Source : ChartClusterMaster.cs
with Apache License 2.0
from AlexWan

private void SendErrorMessage(Exception error)
        {
            if (LogMessageEvent != null)
            {
                LogMessageEvent(error.ToString(), LogMessageType.Error);
            }
            else
            {
                // if no one's subscribed to us and there's a mistake
                // если никто на нас не подписан и происходит ошибка
                System.Windows.MessageBox.Show(error.ToString());
            }
        }

19 Source : ChartClusterMaster.cs
with Apache License 2.0
from AlexWan

void NewLogMessage(string message, LogMessageType type)
        {
            if (LogMessageEvent != null)
            {
                LogMessageEvent(message, type);
            }
            else if (type == LogMessageType.Error)
            {
                // if no one's subscribed to us and there's a mistake
                // если никто на нас не подписан и происходит ошибка
                System.Windows.MessageBox.Show(message);
            }
        }

19 Source : ChartClusterPainter.cs
with Apache License 2.0
from AlexWan

void SendLogMessage(string message, LogMessageType type)
        {
            if (LogMessageEvent != null)
            {
                LogMessageEvent(message, type);
            }
            else if (type == LogMessageType.Error)
            { // если никто на нас не подписан и происходит ошибка
                System.Windows.MessageBox.Show(message);
            }
        }

19 Source : ChartMasterColorKeeper.cs
with Apache License 2.0
from AlexWan

private void SendNewMessage(string message, LogMessageType type)
        {
            if (LogMessageEvent != null)
            {
                LogMessageEvent(message, LogMessageType.Error);
            }
            else if (type == LogMessageType.Error)
            { // если никто на нас не подписан и происходит ошибка
                System.Windows.MessageBox.Show(message);
            }
        }

19 Source : AIndicatorUi.xaml.cs
with Apache License 2.0
from AlexWan

private void _gridIndicators_Click(object sender, EventArgs e)
        {
            try
            {
                int rowIndex = _gridIndicators.SelectedCells[0].RowIndex;
                int cellIndex = _gridIndicators.SelectedCells[0].ColumnIndex;

                if (cellIndex == 2)
                {
                    _indicator.IncludeIndicators[rowIndex].ShowDialog();
                    _indicator.Reload();
                    UpdateGridParam();
                }
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }
        }

19 Source : IndicatorsFactory.cs
with Apache License 2.0
from AlexWan

public static Aindicator CreateIndicatorByName(string nameClreplaced, string name, bool canDelete)
        {
            Aindicator Indicator = null;

           /* if (nameClreplaced == "FBD")
            {
                Indicator = new FBD();
            }*/

            try
            {
                if (Indicator == null)
                {
                    List<string> fullPaths = GetFullNamesFromFolder(@"Custom\Indicators\Scripts");

                    string longNameClreplaced = nameClreplaced + ".txt";
                    string longNameClreplaced2 = nameClreplaced + ".cs";

                    string myPath = "";

                    for (int i = 0; i < fullPaths.Count; i++)
                    {
                        string nameInFile = fullPaths[i].Split('\\')[fullPaths[i].Split('\\').Length - 1];

                        if (nameInFile == longNameClreplaced ||
                            nameInFile == longNameClreplaced2)
                        {
                            myPath = fullPaths[i];
                            break;
                        }
                    }

                    if (myPath == "")
                    {
                        MessageBox.Show("Error! Indicator with name " + nameClreplaced + "not found");
                        return null;
                    }

                    Indicator = Serialize(myPath, nameClreplaced, name, canDelete);
                }

                Indicator.Init(name);
                Indicator.CanDelete = canDelete;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }

            return Indicator;
        }

19 Source : BybitMarketDepthCreator.cs
with Apache License 2.0
from AlexWan

public List<MarketDepth> Update(JToken data)
        {
            if (all_depths.Count() == 0)
                return all_depths;

            lock (locker)
            {
                JToken[] jt_delete = data.SelectToken("delete").ToArray();

                JToken[] jt_update = data.SelectToken("update").ToArray();

                JToken[] jt_insert = data.SelectToken("insert").ToArray();

                if (jt_delete != null && jt_delete.Count() > 0)
                {
                    foreach (var jt_item in jt_delete)
                    {
                        if (jt_item.SelectToken("side").Value<string>() == "Sell")
                        {
                            try
                            {
                                string security_name = jt_item.SelectToken("symbol").Value<string>();

                                var price_to_del = jt_item.SelectToken("price").Value<decimal>();

                                all_depths.Find(x => x.SecurityNameCode == security_name).Asks.Remove(all_depths.Find(x => x.SecurityNameCode == security_name).Asks.Find(x => x.Price == price_to_del));

                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.ToString());
                            }
                        }

                        if (jt_item.SelectToken("side").Value<string>() == "Buy")
                        {
                            try
                            {
                                string security_name = jt_item.SelectToken("symbol").Value<string>();

                                var price_to_del = jt_item.SelectToken("price").Value<decimal>();

                                all_depths.Find(x => x.SecurityNameCode == security_name).Bids.Remove(all_depths.Find(x => x.SecurityNameCode == security_name).Bids.Find(x => x.Price == price_to_del));

                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.ToString());
                            }
                        }
                    }
                }

                if (jt_update != null && jt_update.Count() > 0)
                {
                    foreach (var jt_item in jt_update)
                    {
                        if (jt_item.SelectToken("side").Value<string>() == "Sell")
                        {
                            try
                            {
                                string security_name = jt_item.SelectToken("symbol").Value<string>();

                                var new_ask_level = new MarketDepthLevel()
                                {
                                    Ask = jt_item.SelectToken("size").Value<decimal>(),
                                    Bid = 0,
                                    Price = jt_item.SelectToken("price").Value<decimal>(),
                                };

                                all_depths.Find(x => x.SecurityNameCode == security_name).Asks.Find(x => x.Price == new_ask_level.Price).Ask = new_ask_level.Ask;

                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.ToString());
                            }
                        }

                        if (jt_item.SelectToken("side").Value<string>() == "Buy")
                        {
                            try
                            {
                                string security_name = jt_item.SelectToken("symbol").Value<string>();

                                var new_bid_level = new MarketDepthLevel()
                                {
                                    Ask = 0,
                                    Bid = jt_item.SelectToken("size").Value<decimal>(),
                                    Price = jt_item.SelectToken("price").Value<decimal>(),
                                };

                                all_depths.Find(x => x.SecurityNameCode == security_name).Bids.Find(x => x.Price == new_bid_level.Price).Bid = new_bid_level.Bid;

                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.ToString());
                            }
                        }
                    }
                }

                if (jt_insert != null && jt_insert.Count() > 0)
                {
                    foreach (var jt_item in jt_insert)
                    {
                        if (jt_item.SelectToken("side").Value<string>() == "Sell")
                        {
                            try
                            {
                                string security_name = jt_item.SelectToken("symbol").Value<string>();

                                var new_ask_level = new MarketDepthLevel()
                                {
                                    Ask = jt_item.SelectToken("size").Value<decimal>(),
                                    Bid = 0,
                                    Price = jt_item.SelectToken("price").Value<decimal>(),
                                };

                                InsertLevel(new_ask_level.Price, new_ask_level.Ask, Side.Sell, all_depths.Find(x => x.SecurityNameCode == security_name));

                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.ToString());
                            }
                        }

                        if (jt_item.SelectToken("side").Value<string>() == "Buy")
                        {
                            try
                            {
                                string security_name = jt_item.SelectToken("symbol").Value<string>();

                                var new_bid_level = new MarketDepthLevel()
                                {
                                    Ask = 0,
                                    Bid = jt_item.SelectToken("size").Value<decimal>(),
                                    Price = jt_item.SelectToken("price").Value<decimal>(),
                                };

                                InsertLevel(new_bid_level.Price, new_bid_level.Bid, Side.Buy, all_depths.Find(x => x.SecurityNameCode == security_name));

                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.ToString());
                            }
                        }
                    }
                }

                return all_depths;
            }
        }

19 Source : ConnectorCandles.cs
with Apache License 2.0
from AlexWan

private void SendNewLogMessage(string message, LogMessageType type)
        {
            if (LogMessageEvent != null)
            {
                LogMessageEvent(message, type);
            }
            else if (type == LogMessageType.Error)
            { // if nobody is subscribed to us and there is an error in the log / если на нас никто не подписан и в логе ошибка
                System.Windows.MessageBox.Show(message);
            }
        }

19 Source : OsLocalization.cs
with Apache License 2.0
from AlexWan

public static string ConvertToLocString(string str)
        {
            try
            {
                //"Eng:Main&Ru:Главное меню&"

                string[] locStrings = str.Split('_');

                string engLoc = "";

                for (int i = 0; i < locStrings.Length; i++)
                {
                    if (locStrings[i] == "" || locStrings[i] == " ")
                    {
                        continue;
                    }

                    string [] locCur = locStrings[i].Split(':');

                    OsLocalType cultureTypeCur;
                    if (Enum.TryParse(locCur[0], out cultureTypeCur))
                    {
                        if (cultureTypeCur == CurLocalization)
                        {
                            return locCur[1];
                        }
                        if (cultureTypeCur == OsLocalType.Eng)
                        {
                            engLoc = locCur[1];
                        }
                    }
                }

                return engLoc;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return "error";
            }

        }

19 Source : MarketDepthPainter.cs
with Apache License 2.0
from AlexWan

private void SendNewLogMessage(string message, LogMessageType type)
        {
            if (LogMessageEvent != null)
            {
                LogMessageEvent(message, type);
            }
            else if (type == LogMessageType.Error)
            {
                // if nobody is signed to us and there is an error in the log
                // если на нас никто не подписан и в логе ошибка
                System.Windows.MessageBox.Show(message);
            }
        }

19 Source : Journal.cs
with Apache License 2.0
from AlexWan

private void SendNewLogMessage(string message, LogMessageType type)
        {
            if (LogMessageEvent != null)
            {
                LogMessageEvent(message, type);
            }
            else if (type == LogMessageType.Error)
            {
                System.Windows.MessageBox.Show(message);
            }
        }

19 Source : MfdServer.cs
with Apache License 2.0
from AlexWan

private void SendLogMessage(string message, LogMessageType type)
        {
            if (LogMessageEvent != null)
            {
                LogMessageEvent(message, type);
            }
            else
            {
                MessageBox.Show(message);
            }
        }

19 Source : ServerCandleStorage.cs
with Apache License 2.0
from AlexWan

private void SendNewLogMessage(string message, LogMessageType type)
        {
            if (LogMessageEvent != null)
            {
                LogMessageEvent(message, type);
            }
            else if (type == LogMessageType.Error)
            { // if nobody is subscribed to us and there is a log error / если на нас никто не подписан и в логе ошибка
                System.Windows.MessageBox.Show(message);
            }
        }

19 Source : ChartPainterLine.cs
with Apache License 2.0
from AlexWan

private static Chart CreateChart()
        {
            
            Chart _chart = null;

            try
            {
                _chart = new Chart();
                ChartMasterColorKeeper _colorKeeper = new ChartMasterColorKeeper("chartPainter");

                _chart.Series.Clear();
                _chart.ChartAreas.Clear();
                _chart.BackColor = _colorKeeper.ColorBackChart;
                _chart.SuppressExceptions = true;
                
                ChartArea prime = new ChartArea("Prime")
                {
                    CursorX = { AxisType = AxisType.Secondary, IsUserSelectionEnabled = false, IsUserEnabled = true, IntervalType = DateTimeIntervalType.Auto, Interval = 0.00001 },
                    CursorY = { AxisType = AxisType.Primary, IsUserEnabled = true, IntervalType = DateTimeIntervalType.Auto, Interval = 0.00001 },
                    BorderDashStyle = ChartDashStyle.Solid,
                    BorderWidth = 2,
                    BackColor = _colorKeeper.ColorBackChart,
                    BorderColor = _colorKeeper.ColorBackSecond,
                    
                };

                prime.AxisY.replacedleAlignment = StringAlignment.Near;
                prime.AxisY.replacedleForeColor = _colorKeeper.ColorBackCursor;
                prime.AxisY.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll;

                prime.AxisY.LabelAutoFitMinFontSize = 12;
                prime.AxisY.LabelAutoFitStyle = LabelAutoFitStyles.IncreaseFont;
                foreach (var axe in prime.Axes)
                {
                    axe.LabelStyle.ForeColor = _colorKeeper.ColorText;
                }
                prime.CursorY.LineColor = _colorKeeper.ColorBackCursor;
                prime.CursorX.LineColor = _colorKeeper.ColorBackCursor;

                _chart.ChartAreas.Add(prime);

                Series series = new Series("Series");
                series.ChartType = SeriesChartType.Line;
                series.YAxisType = AxisType.Primary;
                series.XAxisType = AxisType.Secondary;
                series.ChartArea = "Prime";
                series.ShadowOffset = 2;
                series.YValuesPerPoint = 2;
              
                _chart.Series.Add(series);

            }
            catch (Exception error)
            {
                System.Windows.MessageBox.Show(error.ToString());
            }

            return _chart;
        }

19 Source : ChartPainterLine.cs
with Apache License 2.0
from AlexWan

private static void PaintSeriesSafe(Series series, Chart _chart)
        {
            try
            {

                for (int i = 0; i < _chart.Series.Count; i++)
                {
                    if (series.Name == _chart.Series[i].Name)
                    {
                        _chart.Series.Remove(FindSeriesByNameSafe(series.Name, _chart));
                        _chart.Series.Insert(i, series);
                        break;
                    }
                }

            }
            catch (Exception error)
            {
                System.Windows.MessageBox.Show(error.ToString());
            }
        }

19 Source : WalkForwardPeriodsPainter.cs
with Apache License 2.0
from AlexWan

private static Chart CreateChart()
        {
            Chart _chart = null;

            try
            {
                /* if (_chart != null && _chart.InvokeRequired)
                 {
                     _chart.Invoke(new Action(CreateChart));
                     return;
                 }*/

                _chart = new Chart();
                ChartMasterColorKeeper _colorKeeper = new ChartMasterColorKeeper("walkForward");

                _chart.Series.Clear();
                _chart.ChartAreas.Clear();
                _chart.BackColor = _colorKeeper.ColorBackChart;
                _chart.SuppressExceptions = true;

                ChartArea prime = new ChartArea("Prime")
                {
                    CursorX = { AxisType = AxisType.Secondary, IsUserSelectionEnabled = false, IsUserEnabled = true, IntervalType = DateTimeIntervalType.Auto, Interval = 0.00001 },
                    CursorY = { AxisType = AxisType.Primary, IsUserEnabled = true, IntervalType = DateTimeIntervalType.Auto, Interval = 0.00001 },
                    //AxisX2 = { IsMarginVisible = false, Enabled = AxisEnabled.False },
                    BorderDashStyle = ChartDashStyle.Solid,
                    BorderWidth = 2,
                    BackColor = _colorKeeper.ColorBackChart,
                    BorderColor = _colorKeeper.ColorBackSecond,
                };

                prime.AxisY.replacedleAlignment = StringAlignment.Near;
                prime.AxisY.replacedleForeColor = _colorKeeper.ColorBackCursor;
                prime.AxisY.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll;

                prime.AxisY.LabelAutoFitMinFontSize = 12;
                prime.AxisY.LabelAutoFitStyle = LabelAutoFitStyles.IncreaseFont;
                foreach (var axe in prime.Axes)
                {
                    axe.LabelStyle.ForeColor = _colorKeeper.ColorText;
                }
                prime.CursorY.LineColor = _colorKeeper.ColorBackCursor;
                prime.CursorX.LineColor = _colorKeeper.ColorBackCursor;

                _chart.ChartAreas.Add(prime);

                Series clusterSeries = new Series("SeriesCluster");
                clusterSeries.ChartType = SeriesChartType.RangeBar;
                clusterSeries.YAxisType = AxisType.Primary;
                clusterSeries.XAxisType = AxisType.Secondary;
                clusterSeries.ChartArea = "Prime";
                clusterSeries.ShadowOffset = 2;
                clusterSeries.YValuesPerPoint = 2;

                _chart.Series.Add(clusterSeries);

            }
            catch (Exception error)
            {
                System.Windows.MessageBox.Show(error.ToString());
            }

            return _chart;
        }

19 Source : WalkForwardPeriodsPainter.cs
with Apache License 2.0
from AlexWan

private static void PaintSeriesSafe(Series series,Chart _chart)
        {
            try
            {

                    for (int i = 0; i < _chart.Series.Count; i++)
                    {
                        if (series.Name == _chart.Series[i].Name)
                        {
                            _chart.Series.Remove(FindSeriesByNameSafe(series.Name,_chart));
                            _chart.Series.Insert(i, series);
                            break;
                        }
                    }
                
            }
            catch (Exception error)
            {
                System.Windows.MessageBox.Show(error.ToString());
            }
        }

19 Source : BotManualControlUi.xaml.cs
with Apache License 2.0
from 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 Source : PositionCloseUi.xaml.cs
with Apache License 2.0
from AlexWan

void ComboBoxOrderType_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            try
            {
                PositionOpenType type;
                try
                {
                    Enum.TryParse(ComboBoxOrderType.SelectedItem.ToString(), true, out type);
                }
                catch (Exception)
                {
                    return;
                }

                if (type == PositionOpenType.Limit)
                {
                    TextBoxPrice.IsEnabled = true;
                }
                if (type == PositionOpenType.Market)
                {
                    TextBoxPrice.IsEnabled = false;
                }
                if (type == PositionOpenType.Aceberg)
                {
                    TextBoxAcebergOrdersCount.IsEnabled = true;
                    TextBoxPrice.IsEnabled = true;
                }
                else
                {
                    TextBoxAcebergOrdersCount.IsEnabled = false;
                }
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }
        }

19 Source : BotPanelChartUI.xaml.cs
with Apache License 2.0
from AlexWan

private void SendNewLogMessage(string message, LogMessageType type)
        {
            if (LogMessageEvent != null)
            {
                LogMessageEvent(message, type);
            }
            else if (type == LogMessageType.Error)
            {
                MessageBox.Show(message);
            }
        }

19 Source : TabIndexOptimizerUi.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonAccept_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(TextBoxFormula.Text))
            {
                MessageBox.Show("Формула не назначена. Сохранение невозможно.");
                return;
            }

            for (int i = 0; Index.NamesSecurity != null && i < Index.NamesSecurity.Count; i++)
            {
                if (string.IsNullOrEmpty(Index.NamesSecurity[i]))
                {
                    Index.NamesSecurity.RemoveAt(i);
                    i--;
                }
            }

            if (Index.NamesSecurity == null || Index.NamesSecurity.Count == 0)
            {
                MessageBox.Show("Ни одна бумага не назначена. Сохранение невозможно.");
                return;
            }

            if (ComboBoxTimeFrame.SelectedItem == null)
            {
                MessageBox.Show("ТаймФрейм не назначен. Сохранение невозможно.");
                return;
            }

            Enum.TryParse(ComboBoxTimeFrame.SelectedItem.ToString(), out Index.TimeFrame); 
            Index.Formula = TextBoxFormula.Text;

            NeadToSave = true;
            Close();
        }

19 Source : OsTraderMaster.cs
with Apache License 2.0
from AlexWan

private void Load()
        {
            if (!File.Exists(@"Engine\Settings" + _typeWorkKeeper + "Keeper.txt"))
            { // if there is no file we need. Just go out
              // если нет нужного нам файла. Просто выходим
                return;
            }


            int botCount = 0;
            using (StreamReader reader = new StreamReader(@"Engine\Settings" + _typeWorkKeeper + "Keeper.txt"))
            {
                while (!reader.EndOfStream)
                {
                    if (!string.IsNullOrWhiteSpace(reader.ReadLine()))
                    {
                        botCount++;
                    }
                }
            }

            if (botCount == 0)
            {
                return;
            }

            PanelsArray = new List<BotPanel>();

            int boreplacederator = 0;
            using (StreamReader reader = new StreamReader(@"Engine\Settings" + _typeWorkKeeper + "Keeper.txt"))
            {
                while (!reader.EndOfStream)
                {
                    string[] names = reader.ReadLine().Split('@');

                    BotPanel bot = null;

                    if (names.Length > 2)
                    {
                        try
                        {
                            bot = BotFactory.GetStrategyForName(names[1], names[0], _startProgram, Convert.ToBoolean(names[2]));
                        }
                        catch (Exception e)
                        {
                            MessageBox.Show(" Error on bot creation. Bot Name: " + names[1] + " \n" + e.ToString());
                            continue;
                        }
                    }
                    else
                    {
                        bot = BotFactory.GetStrategyForName(names[1], names[0], _startProgram, false);
                    }

                    if (bot != null)
                    {
                        PanelsArray.Add(bot);
                        _tabBotNames.Items.Add(" " + PanelsArray[boreplacederator].NameStrategyUniq + " ");
                        SendNewLogMessage(OsLocalization.Trader.Label2 + PanelsArray[boreplacederator].NameStrategyUniq,
                            LogMessageType.System);
                        boreplacederator++;
                    }

                }
            }
            if (PanelsArray.Count != 0)
            {
                ReloadActivBot(PanelsArray[0]);
            }
        }

19 Source : MainWindow.xaml.cs
with Apache License 2.0
from AlexWan

void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            string message = OsLocalization.MainWindow.Message5 + e.ExceptionObject;

            MessageBox.Show(message);
        }

19 Source : MainWindow.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonTesterCandleOne_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Hide();
                TesterUi candleOneUi = new TesterUi();
                candleOneUi.ShowDialog();
                Close();
                ProccesIsWorked = false;
                Thread.Sleep(5000);
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }
            Process.GetCurrentProcess().Kill();
        }

19 Source : MainWindow.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonRobotCandleOne_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Hide();
                RobotUi candleOneUi = new RobotUi();
                candleOneUi.ShowDialog();
                Close();
                ProccesIsWorked = false;
                Thread.Sleep(5000);
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }
            Process.GetCurrentProcess().Kill();
        }

19 Source : MainWindow.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonData_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Hide();
                OsDataUi ui = new OsDataUi();
                ui.ShowDialog();
                Close();
                ProccesIsWorked = false;
                Thread.Sleep(5000);
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }
            Process.GetCurrentProcess().Kill();
        }

19 Source : MainWindow.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonConverter_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Hide();
                OsConverterUi ui = new OsConverterUi();
                ui.ShowDialog();
                Close();
                ProccesIsWorked = false;
                Thread.Sleep(10000);
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }
            Process.GetCurrentProcess().Kill();
        }

19 Source : MainWindow.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonOptimizer_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Hide();
                OptimizerUi ui = new OptimizerUi();
                ui.ShowDialog();
                Close();
                ProccesIsWorked = false;
                Thread.Sleep(10000);
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }
            Process.GetCurrentProcess().Kill();
        }

19 Source : MainWindow.xaml.cs
with Apache License 2.0
from AlexWan

private void ButtonMiner_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Hide();
                OsMinerUi ui = new OsMinerUi();
                ui.ShowDialog();
                Close();
                ProccesIsWorked = false;
                Thread.Sleep(10000);
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }
            Process.GetCurrentProcess().Kill();
        }

19 Source : MainWindow.xaml.cs
with Apache License 2.0
from AlexWan

private void CandleConverter_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Hide();
                OsCandleConverterUi ui = new OsCandleConverterUi();
                ui.ShowDialog();
                Close();
                ProccesIsWorked = false;
                Thread.Sleep(10000);
            }
            catch (Exception error)
            {
                MessageBox.Show(error.ToString());
            }
            Process.GetCurrentProcess().Kill();
        }

19 Source : OsLocalization.cs
with Apache License 2.0
from AlexWan

public static string ConvertToLocString(string str)
        {
            try
            {
                //"Eng:Main&Ru:Главное меню&"

                string[] locStrings = str.Split('_');

                string engLoc = "";

                for (int i = 0; i < locStrings.Length; i++)
                {
                    if (locStrings[i] == "" || locStrings[i] == " ")
                    {
                        continue;
                    }

                    string[] locCur = locStrings[i].Split(':');

                    OsLocalType cultureTypeCur;
                    if (Enum.TryParse(locCur[0], out cultureTypeCur))
                    {
                        if (cultureTypeCur == CurLocalization)
                        {
                            return locCur[1];
                        }
                        if (cultureTypeCur == OsLocalType.Eng)
                        {
                            engLoc = locCur[1];
                        }
                    }
                }

                return engLoc;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return "error";
            }

        }

19 Source : TelegramApi.cs
with Apache License 2.0
from AlexWan

public async Task<bool> LogIn(int key, string token, string phone)
        {
            try
            {
                if (_client == null)
                {
                    _client = new TelegramClient(key, token);
                    await _client.ConnectAsync();
                }
                if (_user != null)
                {
                    return true;
                }
                _phone = phone;

                var hash = await _client.SendCodeRequestAsync(_phone);

                string code = "";
                
                Application.Current.Dispatcher.Invoke(() =>
                {
                    var input = new InputBox();
                    input.ShowDialog();
                    code = input.Code;
                });
                
                if (string.IsNullOrEmpty(code))
                {
                    MessageBox.Show("Empty code!");
                    return false;
                }

                _user = await _client.MakeAuthAsync(_phone, hash, code);
                if (_user != null)
                {
                    return true;
                }

                return false;
            }
            catch (Exception e)
            {
                _client?.Dispose();
                _client = null;
                _user = null;
                return false;
            }
        }

See More Examples