Beispiel #1
0
        private void OnSaveToolStripMenuItemClick(object sender, EventArgs e)
        {
            if (tabContainer.SelectedTab.Controls.Count == 0)
            {
                return;
            }

            var systemControl = tabContainer.SelectedTab.Controls[0] as SubjectiveSystemControl;

            if (systemControl == null)
            {
                return;
            }

            using (var dialog = new SaveFileDialog())
            {
                dialog.Filter       = @"Pliki stanu (*.state)|*.state";
                dialog.AddExtension = true;

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    SubjectiveSystem.SaveState(systemControl.SystemInstance, dialog.FileName);
                    tabContainer.TabPages.Remove(tabContainer.SelectedTab);
                }
            }
        }
Beispiel #2
0
 public ProcessingWindow(SubjectiveSystem system, ObserverData observerData, ProcessingMethod processingMethod)
 {
     this.system           = system;
     this.observerData     = observerData;
     this.processingMethod = processingMethod;
     InitializeComponent();
 }
Beispiel #3
0
 public void Setup(SubjectiveSystem system)
 {
     bindingSource.DataSource                    = system;
     algorithmsBindingSource.DataSource          = system.Algorithms;
     observersBindingSource.DataSource           = system.ObserversData;
     algorithmsBindingSource.CurrentItemChanged += OnCurrentAlgorithmChanged;
     SystemInstance = system;
     sourceAlgos.Items.AddRange(AlgorithmsNames.All.ToArray());
     RefreshImages();
 }
Beispiel #4
0
 private void OnNewToolStripMenuItemClick(object sender, EventArgs e)
 {
     using (var nameDialog = new NameWindow())
     {
         if (nameDialog.ShowDialog() == DialogResult.OK)
         {
             SubjectiveSystem system = SubjectiveSystem.CreateNew(nameDialog.ObjectName);
             ShowSystem(system);
         }
     }
 }
Beispiel #5
0
        private void ShowSystem(SubjectiveSystem system)
        {
            var newTab = new TabPage();

            newTab.Text = system.SystemName;
            var control = new SubjectiveSystemControl {
                Dock = DockStyle.Fill
            };

            control.Setup(system);
            newTab.Controls.Add(control);
            tabContainer.TabPages.Add(newTab);
            tabContainer.SelectedTab = newTab;
        }
Beispiel #6
0
        private void OnLoadToolStripMenuItemClick(object sender, EventArgs e)
        {
            SubjectiveSystem system = null;

            using (var dialog = new OpenFileDialog())
            {
                dialog.Filter       = @"Pliki stanu (*.state)|*.state";
                dialog.AddExtension = true;

                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                system = SubjectiveSystem.LoadState(dialog.FileName);
            }

            if (system != null)
            {
                ShowSystem(system);
            }
        }