예제 #1
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);
        }
예제 #2
0
// управление

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

            set.NewLogMessageEvent += SendNewLogMessage;

            if (!set.ShowDialog())
            { // пользователь не нажал на кнопку принять в форме
                set.Regime = DataSetState.Off;
                set.Delete();
                return;
            }

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

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

            _sets.Add(set);
            RePaintSetGrid();
            set.Save();
            ChangeActivSet(_sets.Count - 1);
        }
예제 #3
0
        /// <summary>
        /// constructor
        /// конструктор
        /// </summary>
        /// <param name="set">set that needs to be managed/сет которым надо управлять</param>
        public OsDataSetUi(OsDataSet set)
        {
            InitializeComponent();

            _set = set;

            if (set.SetName != "Set_")
            {
                TextBoxFolderName.IsEnabled   = false;
                DatePickerTimeEnd.IsEnabled   = false;
                DatePickerTimeStart.IsEnabled = false;
            }

            TextBoxFolderName.Text = set.SetName.Split('_')[1];

            ComboBoxRegime.Items.Add(DataSetState.Off);
            ComboBoxRegime.Items.Add(DataSetState.On);
            ComboBoxRegime.SelectedItem      = _set.Regime;
            ComboBoxRegime.SelectionChanged += ComboBoxRegime_SelectionChanged;

            CheckBoxTf1SecondIsOn.IsChecked     = set.Tf1SecondIsOn;
            CheckBoxTf2SecondIsOn.IsChecked     = set.Tf2SecondIsOn;
            CheckBoxTf5SecondIsOn.IsChecked     = set.Tf5SecondIsOn;
            CheckBoxTf10SecondIsOn.IsChecked    = set.Tf10SecondIsOn;
            CheckBoxTf15SecondIsOn.IsChecked    = set.Tf15SecondIsOn;
            CheckBoxTf20SecondIsOn.IsChecked    = set.Tf20SecondIsOn;
            CheckBoxTf30SecondIsOn.IsChecked    = set.Tf30SecondIsOn;
            CheckBoxTf1MinuteIsOn.IsChecked     = set.Tf1MinuteIsOn;
            CheckBoxTf2MinuteIsOn.IsChecked     = set.Tf2MinuteIsOn;
            CheckBoxTf5MinuteIsOn.IsChecked     = set.Tf5MinuteIsOn;
            CheckBoxTf10MinuteIsOn.IsChecked    = set.Tf10MinuteIsOn;
            CheckBoxTf15MinuteIsOn.IsChecked    = set.Tf15MinuteIsOn;
            CheckBoxTf30MinuteIsOn.IsChecked    = set.Tf30MinuteIsOn;
            CheckBoxTf1HourIsOn.IsChecked       = set.Tf1HourIsOn;
            CheckBoxTf2HourIsOn.IsChecked       = set.Tf2HourIsOn;
            CheckBoxTf4HourIsOn.IsChecked       = set.Tf4HourIsOn;
            CheckBoxTfTickIsOn.IsChecked        = set.TfTickIsOn;
            CheckBoxTfMarketDepthIsOn.IsChecked = set.TfMarketDepthIsOn;

            CheckBoxNeadToLoadDataInServers.IsChecked = set.NeadToLoadDataInServers;

            List <ServerType> serverTypes = ServerMaster.ServersTypes;

            ComboBoxSource.Items.Add(ServerType.None);

            for (int i = 0; i < serverTypes.Count; i++)
            {
                ComboBoxSource.Items.Add(serverTypes[i]);
            }

            ComboBoxSource.SelectedItem      = _set.Source;
            ComboBoxSource.SelectionChanged += ComboBoxSource_SelectionChanged;
            DatePickerTimeStart.SelectedDate = _set.TimeStart;
            DatePickerTimeEnd.SelectedDate   = _set.TimeEnd;

            ComboBoxCandleCreateType.Items.Add(CandleMarketDataType.Tick);
            ComboBoxCandleCreateType.Items.Add(CandleMarketDataType.MarketDepth);
            ComboBoxCandleCreateType.SelectedItem = _set.CandleCreateType;

            CheckBoxNeadToUpDate.IsChecked = _set.NeadToUpdate;

            for (int i = 1; i < 26; i++)
            {
                ComboBoxMarketDepthDepth.Items.Add(i);
            }

            if (_set.MarketDepthDepth == 0)
            {
                _set.MarketDepthDepth = 1;
            }

            ComboBoxMarketDepthDepth.SelectedItem = _set.MarketDepthDepth;


            CreateSecuritiesTable();
            ReloadSecuritiesOnTable();
            CheckButtons();
            Title                = OsLocalization.Data.TitleDataSet;
            Label3.Content       = OsLocalization.Data.Label3;
            Label4.Content       = OsLocalization.Data.Label4;
            Label15.Content      = OsLocalization.Data.Label15;
            Label16.Content      = OsLocalization.Data.Label16;
            Label17.Content      = OsLocalization.Data.Label17;
            Label18.Content      = OsLocalization.Data.Label18;
            Label19.Content      = OsLocalization.Data.Label19;
            Label20.Content      = OsLocalization.Data.Label20;
            ButtonAccept.Content = OsLocalization.Data.ButtonAccept;
            CheckBoxNeadToLoadDataInServers.Content = OsLocalization.Data.Label21;
            CheckBoxNeadToUpDate.Content            = OsLocalization.Data.Label22;
        }
예제 #4
0
        /// <summary>
        /// конструктор
        /// </summary>
        /// <param name="set">сет которым надо управлять</param>
        public OsDataSetUi(OsDataSet set)
        {
            InitializeComponent();

            _set = set;

            if (set.SetName != "Set_")
            {
                TextBoxFolderName.IsEnabled   = false;
                DatePickerTimeEnd.IsEnabled   = false;
                DatePickerTimeStart.IsEnabled = false;
            }

            TextBoxFolderName.Text = set.SetName.Split('_')[1];

            ComboBoxRegime.Items.Add(DataSetState.Off);
            ComboBoxRegime.Items.Add(DataSetState.On);
            ComboBoxRegime.SelectedItem      = _set.Regime;
            ComboBoxRegime.SelectionChanged += ComboBoxRegime_SelectionChanged;

            CheckBoxTf1SecondIsOn.IsChecked     = set.Tf1SecondIsOn;
            CheckBoxTf2SecondIsOn.IsChecked     = set.Tf2SecondIsOn;
            CheckBoxTf5SecondIsOn.IsChecked     = set.Tf5SecondIsOn;
            CheckBoxTf10SecondIsOn.IsChecked    = set.Tf10SecondIsOn;
            CheckBoxTf15SecondIsOn.IsChecked    = set.Tf15SecondIsOn;
            CheckBoxTf20SecondIsOn.IsChecked    = set.Tf20SecondIsOn;
            CheckBoxTf30SecondIsOn.IsChecked    = set.Tf30SecondIsOn;
            CheckBoxTf1MinuteIsOn.IsChecked     = set.Tf1MinuteIsOn;
            CheckBoxTf2MinuteIsOn.IsChecked     = set.Tf2MinuteIsOn;
            CheckBoxTf5MinuteIsOn.IsChecked     = set.Tf5MinuteIsOn;
            CheckBoxTf10MinuteIsOn.IsChecked    = set.Tf10MinuteIsOn;
            CheckBoxTf15MinuteIsOn.IsChecked    = set.Tf15MinuteIsOn;
            CheckBoxTf30MinuteIsOn.IsChecked    = set.Tf30MinuteIsOn;
            CheckBoxTf1HourIsOn.IsChecked       = set.Tf1HourIsOn;
            CheckBoxTf2HourIsOn.IsChecked       = set.Tf2HourIsOn;
            CheckBoxTfTickIsOn.IsChecked        = set.TfTickIsOn;
            CheckBoxTfMarketDepthIsOn.IsChecked = set.TfMarketDepthIsOn;

            CheckBoxNeadToLoadDataInServers.IsChecked = set.NeadToLoadDataInServers;

            ComboBoxSource.Items.Add(ServerType.Unknown);
            ComboBoxSource.Items.Add(ServerType.InteractivBrokers);
            ComboBoxSource.Items.Add(ServerType.Plaza);
            ComboBoxSource.Items.Add(ServerType.Quik);
            ComboBoxSource.Items.Add(ServerType.SmartCom);
            ComboBoxSource.Items.Add(ServerType.Finam);

            ComboBoxSource.SelectedItem      = _set.Source;
            ComboBoxSource.SelectionChanged += ComboBoxSource_SelectionChanged;
            DatePickerTimeStart.SelectedDate = _set.TimeStart;
            DatePickerTimeEnd.SelectedDate   = _set.TimeEnd;

            ComboBoxCandleCreateType.Items.Add(CandleSeriesCreateDataType.Tick);
            ComboBoxCandleCreateType.Items.Add(CandleSeriesCreateDataType.MarketDepth);
            ComboBoxCandleCreateType.SelectedItem = _set.CandleCreateType;

            CheckBoxNeadToUpDate.IsChecked = _set.NeadToUpdate;

            for (int i = 1; i < 26; i++)
            {
                ComboBoxMarketDepthDepth.Items.Add(i);
            }

            if (_set.MarketDepthDepth == 0)
            {
                _set.MarketDepthDepth = 1;
            }

            ComboBoxMarketDepthDepth.SelectedItem = _set.MarketDepthDepth;


            CreateSecuritiesTable();
            ReloadSecuritiesOnTable();
            CheckButtons();
        }