Example #1
0
        /// <summary>
        /// check button activity
        /// проверить активность кнопок
        /// </summary>
        private void CheckButtons()
        {
            DataSetState currentState;

            Enum.TryParse(ComboBoxRegime.SelectedItem.ToString(), out currentState);

            if (currentState == DataSetState.On)
            {
                EnableControls(false);
            }
            else
            {
                EnableControls();

                IServerPermission permission = null;

                if (ComboBoxSource.SelectedItem != null)
                {
                    ServerType type;
                    Enum.TryParse(ComboBoxSource.SelectedItem.ToString(), out type);
                    permission = ServerMaster.GetServerPermission(type);
                }

                if (permission == null)
                {
                    CheckBoxTf1MinuteIsOn.IsEnabled  = true;
                    CheckBoxTf2MinuteIsOn.IsEnabled  = true;
                    CheckBoxTf5MinuteIsOn.IsEnabled  = true;
                    CheckBoxTf10MinuteIsOn.IsEnabled = true;
                    CheckBoxTf15MinuteIsOn.IsEnabled = true;
                    CheckBoxTf30MinuteIsOn.IsEnabled = true;
                    CheckBoxTf1HourIsOn.IsEnabled    = true;
                    CheckBoxTf2HourIsOn.IsEnabled    = true;
                    CheckBoxTf4HourIsOn.IsEnabled    = true;

                    CheckBoxTf1SecondIsOn.IsEnabled  = true;
                    CheckBoxTf2SecondIsOn.IsEnabled  = true;
                    CheckBoxTf5SecondIsOn.IsEnabled  = true;
                    CheckBoxTf10SecondIsOn.IsEnabled = true;
                    CheckBoxTf15SecondIsOn.IsEnabled = true;
                    CheckBoxTf20SecondIsOn.IsEnabled = true;
                    CheckBoxTf30SecondIsOn.IsEnabled = true;

                    CheckBoxTfMarketDepthIsOn.IsEnabled = true;
                    CheckBoxTfTickIsOn.IsEnabled        = true;
                }
                else
                {
                    CheckBoxTf1MinuteIsOn.IsEnabled  = permission.DataFeedTf1MinuteCanLoad;
                    CheckBoxTf2MinuteIsOn.IsEnabled  = permission.DataFeedTf2MinuteCanLoad;
                    CheckBoxTf5MinuteIsOn.IsEnabled  = permission.DataFeedTf5MinuteCanLoad;
                    CheckBoxTf10MinuteIsOn.IsEnabled = permission.DataFeedTf10MinuteCanLoad;
                    CheckBoxTf15MinuteIsOn.IsEnabled = permission.DataFeedTf15MinuteCanLoad;
                    CheckBoxTf30MinuteIsOn.IsEnabled = permission.DataFeedTf30MinuteCanLoad;
                    CheckBoxTf1HourIsOn.IsEnabled    = permission.DataFeedTf1HourCanLoad;
                    CheckBoxTf2HourIsOn.IsEnabled    = permission.DataFeedTf2HourCanLoad;
                    CheckBoxTf4HourIsOn.IsEnabled    = permission.DataFeedTf4HourCanLoad;

                    CheckBoxTf1SecondIsOn.IsEnabled  = permission.DataFeedTf1SecondCanLoad;
                    CheckBoxTf2SecondIsOn.IsEnabled  = permission.DataFeedTf2SecondCanLoad;
                    CheckBoxTf5SecondIsOn.IsEnabled  = permission.DataFeedTf5SecondCanLoad;
                    CheckBoxTf10SecondIsOn.IsEnabled = permission.DataFeedTf10SecondCanLoad;
                    CheckBoxTf15SecondIsOn.IsEnabled = permission.DataFeedTf15SecondCanLoad;
                    CheckBoxTf20SecondIsOn.IsEnabled = permission.DataFeedTf20SecondCanLoad;
                    CheckBoxTf30SecondIsOn.IsEnabled = permission.DataFeedTf30SecondCanLoad;

                    CheckBoxTfMarketDepthIsOn.IsEnabled = permission.DataFeedTfMarketDepthCanLoad;
                    CheckBoxTfTickIsOn.IsEnabled        = permission.DataFeedTfTickCanLoad;
                }
            }
        }