Beispiel #1
0
// управление

        /// <summary>
        /// создать новый сет
        /// </summary>
        public void CreateNewSet()
        {
            if (_sets == null)
            {
                _sets = new List <OsDataSet>();
            }
            OsDataSet set = new OsDataSet("Set_", _comboBoxSecurity, _comboBoxTimeFrame);

            set.NewLogMessageEvent += SendNewLogMessage;
            set.ShowDialog();

            if (set.SetName == "Set_")
            {
                set.Regime = DataSetState.Off;
                set.Delete();
                MessageBox.Show(@"Создание сета прервано. Необходимо дать сету имя!");
                return;
            }

            if (_sets.Find(dataSet => dataSet.SetName == set.SetName) != null)
            {
                MessageBox.Show(@"Создание сета прервано. Сет с таким именем уже существует!");
                return;
            }

            _sets.Add(set);
            RePaintSetGrid();
            set.Save();
            ChangeActivSet(_sets.Count - 1);
        }
Beispiel #2
0
        /// <summary>
        /// save settings
        /// сохранить настройки
        /// </summary>
        private void SaveSettings()
        {
            TextBoxFolderName.Text = TextBoxFolderName.Text.Replace("_", "");
            TextBoxFolderName.Text = TextBoxFolderName.Text.Replace("Set", "");

            _set.SetName = "Set_" + TextBoxFolderName.Text;

            DataSetState regime;

            Enum.TryParse(ComboBoxRegime.SelectedItem.ToString(), out regime);
            _set.Regime = regime;

            _set.Tf1SecondIsOn     = CheckBoxTf1SecondIsOn.IsChecked.Value;
            _set.Tf2SecondIsOn     = CheckBoxTf2SecondIsOn.IsChecked.Value;
            _set.Tf5SecondIsOn     = CheckBoxTf5SecondIsOn.IsChecked.Value;
            _set.Tf10SecondIsOn    = CheckBoxTf10SecondIsOn.IsChecked.Value;
            _set.Tf15SecondIsOn    = CheckBoxTf15SecondIsOn.IsChecked.Value;
            _set.Tf20SecondIsOn    = CheckBoxTf20SecondIsOn.IsChecked.Value;
            _set.Tf30SecondIsOn    = CheckBoxTf30SecondIsOn.IsChecked.Value;
            _set.Tf1MinuteIsOn     = CheckBoxTf1MinuteIsOn.IsChecked.Value;
            _set.Tf2MinuteIsOn     = CheckBoxTf2MinuteIsOn.IsChecked.Value;
            _set.Tf5MinuteIsOn     = CheckBoxTf5MinuteIsOn.IsChecked.Value;
            _set.Tf10MinuteIsOn    = CheckBoxTf10MinuteIsOn.IsChecked.Value;
            _set.Tf15MinuteIsOn    = CheckBoxTf15MinuteIsOn.IsChecked.Value;
            _set.Tf30MinuteIsOn    = CheckBoxTf30MinuteIsOn.IsChecked.Value;
            _set.Tf1HourIsOn       = CheckBoxTf1HourIsOn.IsChecked.Value;
            _set.Tf2HourIsOn       = CheckBoxTf2HourIsOn.IsChecked.Value;
            _set.Tf4HourIsOn       = CheckBoxTf4HourIsOn.IsChecked.Value;
            _set.TfTickIsOn        = CheckBoxTfTickIsOn.IsChecked.Value;
            _set.TfMarketDepthIsOn = CheckBoxTfMarketDepthIsOn.IsChecked.Value;
            _set.MarketDepthDepth  = Convert.ToInt32(ComboBoxMarketDepthDepth.SelectedValue.ToString());

            Enum.TryParse(ComboBoxCandleCreateType.Text, out _set.CandleCreateType);

            if (ComboBoxSource.SelectedItem != null)
            {
                Enum.TryParse(ComboBoxSource.SelectedItem.ToString(), out _set.Source);
            }

            _set.TimeStart = DatePickerTimeStart.SelectedDate.Value;
            _set.TimeEnd   = DatePickerTimeEnd.SelectedDate.Value;

            _set.NeadToUpdate = CheckBoxNeadToUpDate.IsChecked.Value;

            _set.NeadToLoadDataInServers = CheckBoxNeadToLoadDataInServers.IsChecked.Value;

            _set.Save();
        }
Beispiel #3
0
        // management/управление

        /// <summary>
        /// create new set/создать новый сет
        /// </summary>
        public void CreateNewSet()
        {
            if (_sets == null)
            {
                _sets = new List <OsDataSet>();
            }
            OsDataSet set = new OsDataSet("Set_", _comboBoxSecurity, _comboBoxTimeFrame);

            set.NewLogMessageEvent += SendNewLogMessage;

            if (!set.ShowDialog())
            { // the user did not press the accept button in the form/пользователь не нажал на кнопку принять в форме
                set.Regime = DataSetState.Off;
                set.Delete();
                return;
            }

            if (set.SetName == "Set_")
            {
                set.Regime = DataSetState.Off;
                set.Delete();
                MessageBox.Show(OsLocalization.Data.Label10);
                return;
            }

            if (_sets.Find(dataSet => dataSet.SetName == set.SetName) != null)
            {
                MessageBox.Show(OsLocalization.Data.Label11);
                set.Regime = DataSetState.Off;
                set.Delete();
                return;
            }

            _sets.Add(set);
            RePaintSetGrid();
            set.Save();
            ChangeActivSet(_sets.Count - 1);
        }