Esempio n. 1
0
            public static void Init(SyncDetailInfoForm2 form)
            {
                helpers = new SyncStatusFormHelper[7];

                helpers[0] = new SyncStatusFormHelper(SyncStatus.FetchingElements, new List <Control>()
                {
                    form.panel_fetchFD
                });
                helpers[1] = new SyncStatusFormHelper(SyncStatus.DetectingChanges, new List <Control>()
                {
                    form.panel_detectCh, form.panel_detectCh_chTypes
                });
                helpers[2] = new SyncStatusFormHelper(SyncStatus.CreatingFolders, new List <Control>()
                {
                    form.panel_crDirs
                });
                helpers[3] = new SyncStatusFormHelper(SyncStatus.ApplyingFileChanges, new List <Control>()
                {
                    form.panel_applyCh_speed, form.panel_applyCh_syncedFiles
                });
                helpers[4] = new SyncStatusFormHelper(SyncStatus.RemoveDirs, new List <Control>()
                {
                    form.panel_remDirs
                });
                helpers[5] = new SyncStatusFormHelper(SyncStatus.Finished, new List <Control>()
                {
                });
                helpers[6] = new SyncStatusFormHelper(SyncStatus.Aborted, new List <Control>()
                {
                });
            }
Esempio n. 2
0
        /// <summary>
        /// create SyncDetailInfoForm2 that displays all details of a synchronisation process
        /// </summary>
        /// <param name="l">link that contains the synchronisation information</param>
        public SyncDetailInfoForm2(SyncLink l)
        {
            _l = l;

            InitializeComponent();

            statusProgressBar1.StatusTitles = SyncStatus.GetGroupedTitles();
            statusProgressBar1.ActivateStatus("fetching files/dirs");

            SyncStatusFormHelper.Init(this);

            tabControl_left1.SelectedIndex = 1;
            label_title.Text          = _l.Title;
            label_link_folder1.Text   = _l.Path1;
            label_link_folder2.Text   = _l.Path2;
            label_link_direction.Text = _l.Direction.ToString();

            if (SI != null)
            {
                //build tree (pause sync while building)
                bool running = _l.IsRunning;
                if (running)
                {
                    _l.PauseSync();
                }
                int ct = 0;
                int i  = 0;
                while (_l.SyncTask != null && _l.SyncTask.TasksRunning() > 0 && i < 5)
                {
                    if (ct == _l.SyncTask.TasksRunning())
                    {
                        i++;
                    }
                    else
                    {
                        ct = _l.SyncTask.TasksRunning();
                        i  = 0;
                    }
                    Thread.Sleep(300);
                }
                if (_l.SyncTask != null)
                {
                    BuildTreeBase(_l.SyncInfo.DirTree);
                    SI.SetListener(this);
                    if (running)
                    {
                        _l.ResumeSync();
                    }
                }
            }

            Load += delegate { StartUpdateRoutine(); };
        }
Esempio n. 3
0
        /// <summary>
        /// update tab "Sync Info" in Form
        /// </summary>
        /// <param name="updateAll">if false some update processes may suspend, due to their lesser importance</param>
        public void UpdateSyncProgressInfos(bool updateAll)
        {
            // suspend updating general infos {uProgressIGeneralIF} times
            if (updateAll || _generalRoundCount <= 0)
            {
                progressBar.Value         = SI.SyncProgress;
                label_syst_progress.Text  = $"{SI.SyncProgress:0.00}%";
                label_syst_totalTime.Text = SI.Time.Total.ToString(@"hh\:mm\:ss");

                if (SI.Paused != _oldPaused)
                {
                    button_pr.BackgroundImage = SI.Paused ? Properties.Resources.ic_play_white : Properties.Resources.ic_pause_white;
                    _oldPaused = SI.Paused;
                }

                if (SI.Status != _oldStatus)
                {
                    panel_header.BackColor = SI.Status.Color;
                    statusProgressBar1.ActivateStatus(SI.Status.Title);
                    statusProgressBar1.ActivatedStatusColor = SI.Status.Color;

                    if (_oldStatus != null)
                    {
                        SyncStatusFormHelper oldHelper = SyncStatusFormHelper.GetFromStatus(_oldStatus);
                        foreach (Control c in oldHelper.InfControls)
                        {
                            c.Visible = false;
                        }
                    }

                    SyncStatusFormHelper newHelper = SyncStatusFormHelper.GetFromStatus(SI.Status);
                    foreach (Control c in newHelper.InfControls)
                    {
                        c.Visible = true;
                    }

                    _oldStatus = SI.Status;
                }

                _generalRoundCount = uProgressIGeneralIF;
            }
            else
            {
                _generalRoundCount--;
            }


            if (tabControl_left1.SelectedTab == tabPage_syncInfo)
            {
                if (SI.Status == SyncStatus.FetchingElements)
                {
                    label_fetchFD_filesFound.Text   = SI.Files.FoundCount.ToString();
                    label_fetchFD_foldersFound.Text = SI.Dirs.FoundCount.ToString();
                }
                else if (SI.Status == SyncStatus.DetectingChanges)
                {
                    label_detectCh_changesDetected.Text = (SI.Files.ChangedFoundCount + SI.Dirs.ChangedFoundCount).ToString();
                    label_detectCh_FDDone.Text          = (SI.Files.DetectedCount + SI.Dirs.DetectedCount).ToString(); //TODO: should not be less than changesDetected

                    label_detectCh_filesToCopy.Text     = SI.Files.ToCopyCount.ToString();
                    label_detectCh_filesToRemove.Text   = SI.Files.ToRemoveCount.ToString();
                    label_detectCh_foldersToCreate.Text = SI.Dirs.ToCreateCount.ToString();
                    label_detectCh_foldersToRemove.Text = SI.Dirs.ToRemoveCount.ToString();
                }
                else if (SI.Status == SyncStatus.CreatingFolders)
                {
                    label_crDirs_dirsCreated.Text = $"{SI.Dirs.ChangesAppliedCount} of {SI.Dirs.FoundCount}";
                }
                else if (SI.Status == SyncStatus.ApplyingFileChanges)
                {
                    label_applyCh_speed_current.Text = $"{SI.ActSpeed:0.00} Mbit/s";
                    label_applyCh_speed_average.Text = $"{SI.AverageSpeed:0.00} Mbit/s";

                    label_applyCh_copiedFilesCount.Text = $"{SI.Files.CopiedCount:#,#} of {SI.Files.ToCopyCount:#,#}";
                    label_applyCh_copiedFilesSize.Text  = $"{SI.Files.CopiedSize / (1024.0 * 1024.0):#,#0.00} of " +
                                                          $"{SI.Files.TotalSizeToCopy / (1024.0 * 1024.0):#,#0.00}MB";

                    label_applyCh_removedFilesCount.Text = $"{SI.Files.RemovedCount:#,#} of {SI.Files.ToCopyCount:#,#}";
                    label_applyCh_removedFilesSize.Text  = $"{SI.Files.RemovedSize / (1024.0 * 1024.0):#,#0.00} of " +
                                                           $"{SI.Files.TotalSizeToRemove / (1024.0 * 1024.0):#,#0.00}MB";
                }
                else if (SI.Status == SyncStatus.RemoveDirs)
                {
                    label_remDirs_foldersRemoved.Text = $"{SI.Dirs.RemovedCount} of {SI.Dirs.ToRemoveCount}";
                }
            }
        }
Esempio n. 4
0
            public static void Init(SyncDetailInfoForm2 form)
            {
                helpers = new SyncStatusFormHelper[7];

                helpers[0] = new SyncStatusFormHelper(SyncStatus.FetchingElements, new List<Control>()
                    {form.panel_fetchFD});
                helpers[1] = new SyncStatusFormHelper(SyncStatus.DetectingChanges, new List<Control>()
                    {form.panel_detectCh, form.panel_detectCh_chTypes});
                helpers[2] = new SyncStatusFormHelper(SyncStatus.CreatingFolders, new List<Control>()
                    {form.panel_crDirs });
                helpers[3] = new SyncStatusFormHelper(SyncStatus.ApplyingFileChanges, new List<Control>()
                    {form.panel_applyCh_speed, form.panel_applyCh_syncedFiles});
                helpers[4] = new SyncStatusFormHelper(SyncStatus.RemoveDirs, new List<Control>()
                    {form.panel_remDirs});
                helpers[5] = new SyncStatusFormHelper(SyncStatus.Finished, new List<Control>()
                { });
                helpers[6] = new SyncStatusFormHelper(SyncStatus.Aborted, new List<Control>()
                { });
            }