コード例 #1
0
        private void TelegramServerLabel_MouseLeftButtonUp(object sender, RoutedEventArgs e)
        {
            if (DatabaseLogicClass.SQLiteGet("SELECT boolvalue FROM servicetable WHERE service='TelegramService'") == "1")
            {
                DatabaseLogicClass.SQLiteExecute("UPDATE servicetable SET boolvalue = 0 WHERE service='TelegramService'");
                TelegramServerLabel.Content = "Сервер Telegram: выключен";
                TG_obj.TelegramInit(2, true);
            }

            else
            {
                DatabaseLogicClass.SQLiteExecute("UPDATE servicetable SET boolvalue = 1 WHERE service='TelegramService'");
                TelegramServerLabel.Content = "Сервер Telegram: включен";

                if (TG_obj == null)
                {
                    TG_obj = new TelegramClass();
                    TG_obj.TelegramInit(1, true);
                }

                TG_obj.TelegramInit(3, true);
            }
        }
コード例 #2
0
        private void Window_Initialized(object sender, EventArgs e)
        {
            if (PingClass.CheckForInternetConnection() == false)
            {
                MessageBox.Show("Проверьте подключение и повторите попытку");
                Close();
            }
            else
            {
                SetColor();
                DispatcherTimer ColorTimer = new DispatcherTimer();
                ColorTimer.Tick    += new EventHandler(ColorTimer_Tick);
                ColorTimer.Interval = new TimeSpan(0, 0, 0, 3);
                ColorTimer.Start();

                TG_obj = new TelegramClass();
                if (DatabaseLogicClass.SQLiteGet("SELECT boolvalue FROM servicetable WHERE service='TelegramService'") == "1")
                {
                    TG_obj.TelegramInit(1, true);
                    TelegramEnabled = true;
                }
                else if (DatabaseLogicClass.SQLiteGet("SELECT boolvalue FROM servicetable WHERE service='TelegramService'") == "0")
                {
                    TG_obj.TelegramInit(1, false);
                    TelegramEnabled = false;
                    TG_obj.TelegramInit(2, false);
                }

                if (DatabaseLogicClass.SQLiteGet("SELECT savedbool FROM savedlogin WHERE id=1") == "1")
                {
                    LoginTextBox.Text           = DatabaseLogicClass.SQLiteGet("SELECT login FROM savedlogin WHERE id=1");
                    PasswordBox.Password        = DatabaseLogicClass.SQLiteGet("SELECT pass FROM savedlogin WHERE id=1");
                    ThisAutoLoginEnabled        = true;
                    SaveLoginCheckBox.IsChecked = true;
                }
            }
        }