Beispiel #1
0
        private void SwitchToCommunicationTab()
        {
            var comm = TabCollection.OfType <CommunicationViewModel>().FirstOrDefault();

            if (comm == null)
            {
                return;
            }
            SelectedTab   = comm;
            comm.TabIndex = 0;
        }
Beispiel #2
0
 private bool AreConnections()
 {
     if (TabCollection.OfType <MainUnitViewModel>().Any(model => model.ConnectType != ConnectType.None))
     {
         return(true);
     }
     MessageBox.Show(Main.MessageBoxNoConnectionText, Main.MessageBoxNoConnectionTitle, MessageBoxButton.OK,
                     MessageBoxImage.Exclamation);
     SelectedTab = TabCollection.FirstOrDefault(n => n is CommunicationViewModel);
     return(false);
 }
Beispiel #3
0
        private void GetSystem()
        {
            foreach (var s in CommunicationViewModel.OpenConnections.Where(s => s.ConnectMode == ConnectMode.Install).Select(n => n.UnitId)
                     .Except(TabCollection.OfType <MainUnitViewModel>().Select(u => u.Id)))
            {
                AddMainUnit(s);
            }

            var nq = new DownloadView();

            nq.Title      = "Download to PC ESC => GUI";
            nq.Background = System.Windows.Media.Brushes.LightGreen;
            var qq = new CommunicationReceive(this);//  EscCommunicationBase(this);

            nq.DataContext = qq;
            nq.Show();
        }
Beispiel #4
0
        /// <summary>
        /// Checks timestamps
        /// </summary>
        /// <returns>true in case timestamp does compare</returns>
        private async Task <List <MainUnitViewModel> > VerifyIntegratyAsync()
        {
            var list = new List <MainUnitViewModel>();

            foreach (var tab in TabCollection.OfType <MainUnitViewModel>()
                     .Where(model => model.ConnectType != ConnectType.None))
            {
                MainUnitViewModel tab1 = tab;
                var q = await Task.Run(() => tab1.TimestampIsEqual());

                if (q)
                {
                    continue;    //checksum O.K.
                }
                list.Add(tab);
            }

            return(list);
        }
Beispiel #5
0
 private void SendUnitData()
 {
     if (TabCollection.OfType <MainUnitViewModel>().All(model => model.ConnectType == ConnectType.None))
     {
         MessageBox.Show(Main.MessageBoxUploadText, Main.MessageBoxUploadTitle,
                         MessageBoxButton.OK, MessageBoxImage.Question);
         SwitchToCommunicationTab();
     }
     else
     {
         var nq = new DownloadView
         {
             Title      = "UPLOAD to ESC: GUI => ESC",
             Background = System.Windows.Media.Brushes.LightCoral
         };
         var qq = new CommunicationSend(this);//  EscCommunicationBase(this);
         nq.DataContext = qq;
         nq.Show();
     }
 }