Пример #1
0
        private void AddObserversFromFile(string path)
        {
            var observerSettingsList = ObserversFile.Load(path);

            if (observerSettingsList.Count == 0)
            {
                using (var centerAligner = new DialogCenterAligner(this))
                {
                    MessageBox.Show(Resources.FailedOpenFile + "\n" + path, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return;
            }
            if (!RecentFiles.Exists || RecentFiles.CanWrite)
            {
                RecentFiles.Add(path);
            }
            var tabPages = new TabPage[observerSettingsList.Count];

            for (int i = 0; i < observerSettingsList.Count; i++)
            {
                var observer = new Observer(ObservedProcess, observerSettingsList[i]);
                Observers.Add(observer);
                var observerTabPage = new ObserverTabPage(Observers.Count - 1, observer);
                tabPages[i] = observerTabPage;
            }
            ObserverTabControl.TabPages.AddRange(tabPages);
        }
Пример #2
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            var observer = new Observer(ObservedProcess);

            Observers.Add(observer);
            var observerTabPage = new ObserverTabPage(Observers.Count - 1, observer);

            ObserverTabControl.TabPages.Add(observerTabPage);
            ObserverTabControl.SelectedTab = observerTabPage;
            RefreshView();
        }
Пример #3
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            var observer = new Observer(TesseractEngine, SpeechSynthesizer);

            observer.Started += Observer_Started;
            observer.Stopped += Observer_Stopped;
            Observers.Add(observer);
            var observerTabPage = new ObserverTabPage(ObserverTabControl, Observers.Count - 1, observer);

            //ObserverTabControl.TabPages.Add(observerTabPage);
            ObserverTabControl.SelectedTab = observerTabPage;
            RefreshView();
        }