예제 #1
0
        private void ConnectCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            Telemetry.Instance.Native.TrackEvent("Main.Connect");
            var dialog = new ConnectWindow();

            if (dialog.ShowDialog() == true)
            {
                Connected(dialog.Client);
            }
        }
예제 #2
0
        private void Connect(object sender, RoutedEventArgs e)
        {
            var connectionWindow = new ConnectWindow();

            if (connectionWindow.ShowDialog() == true)
            {
                DispatcherTimer timer = new DispatcherTimer();
                timer.Interval = TimeSpan.FromSeconds(2);
                timer.Tick    += async(sender2, e2) => await RetrieveSessions();

                timer.Start();
            }
        }
예제 #3
0
 /// <summary>
 ///При загрузке окна сразу загружает окно авторизации на брокере
 ///Все настройки и запускает поток таймера для проверки подключения к брокеру.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     ListItemIoT.SelectionMode = SelectionMode.Multiple;
     UpdateStatus("No Connected", Brushes.Red);
     ConnectWindowToBroker = new ConnectWindow();
     ConnectWindowToBroker.ShowDialog();
     Task.Delay(15000);
     if (ConnectWindowToBroker.IsTrueAndConnectToBroker == true)
     {
         PersonStatus();
         UpdateControlForm();
         ArrayIoTConnection.TimerStartToUpdate();
     }
 }
예제 #4
0
 /// <summary>
 /// Отправляет сообщение Брокеру, для управления Интернета Вещей.
 /// Если подключение было выполенено то можно продолжать управление Интернета Вещей, если нет-то
 /// появится окно предупреждения, и будет повторно открыто окно повторного подключения.
 /// </summary
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private void SendButton_Click(object sender, RoutedEventArgs e)
 {
     if (ConnectWindowToBroker.IsTrueAndConnectToBroker == true)
     {
         TalkToIoTtextBox.Text += "[" + DateTime.Now.ToString() + "]" + "  " + ConnectWindow.NewConnect.IDClient + ": " + SendMessageTextBox.Text + "\n";
         Analize.TrueWrite.RegularExForSendMessage(SendMessageTextBox.Text);
         SendMessageTextBox.Text = null;
         PersonStatus();
     }
     else
     {
         ConnectWindowToBroker.Dispose();
         var result = MessageBox.Show("Вы не подключены." + "\n" + "Подключитесь", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
         if (result == MessageBoxResult.OK)
         {
             ConnectWindowToBroker = new ConnectWindow();
             ConnectWindowToBroker.ShowDialog();
         }
     }
 }
예제 #5
0
        public bool Connect()
        {
            ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;

            var connectionDialog = new ConnectWindow();

            connectionDialog.ShowDialog();

            if (connectionDialog.DialogResult == true)
            {
                CrmServiceClient         = connectionDialog.Presenter.CrmConnectionMgr.CrmSvc;
                OrganizationFriendlyName = connectionDialog.Presenter.CrmConnectionMgr.ConnectedOrgFriendlyName;
                OrganizationUniqueName   = connectionDialog.Presenter.CrmConnectionMgr.ConnectedOrgUniqueName;

                OrganizationServiceProxy = CrmServiceClient.OrganizationServiceProxy;

                return(true);
            }

            return(false);
        }
예제 #6
0
 private void MenuItem_Click(object sender, RoutedEventArgs e)
 {
     connectWindow = new ConnectWindow();
     connectWindow.ShowDialog();
     connectWindow.Owner = this;
     if (connectWindow.DialogResult != null && connectWindow.DialogResult.Value)
     {
         client.Start(Properties.Settings.Default.nickname);
     }
 }