Ejemplo n.º 1
0
        private void InitializePanels()
        {
            WaitPopup.UpdateProgress(0, 10);

            NavigationPanel = new NavigationPanel(ProjectManager);
            WaitPopup.UpdateProgress(1, 10);

            ViewportPanel = new ViewportPanel(ProjectManager);
            WaitPopup.UpdateProgress(2, 10);

            ValidationPanel = new ValidationPanel(ProjectManager);
            WaitPopup.UpdateProgress(3, 10);

            PropertiesPanel = new PartPropertiesPanel(ProjectManager);
            WaitPopup.UpdateProgress(4, 10);

            DetailPanel = new ElementDetailPanel(ProjectManager);
            WaitPopup.UpdateProgress(5, 10);

            StudConnectionPanel = new StudConnectionPanel(ProjectManager);
            WaitPopup.UpdateProgress(6, 10);

            ConnectionPanel = new ConnectionEditorPanel(ProjectManager);
            WaitPopup.UpdateProgress(7, 10);

            InfoPanel = new ProjectInfoPanel(ProjectManager);
            WaitPopup.UpdateProgress(8, 10);
        }
Ejemplo n.º 2
0
        public bool Load(TRecord record)
        {
            if (record == null)
            {
                throw new ArgumentNullException(nameof(record));
            }

            if (Save())
            {
                if (_record != null)
                {
                    _priorRecord = _record;
                }
                _record  = record;
                _suspend = true;
                foreach (var action in _setControls)
                {
                    action.Invoke(record);
                }
                RecordLoaded?.Invoke(this, new EventArgs());
                ValidationPanel?.SetStatus(RecordStatus.Valid, "Record loaded");
                ToolStrip?.OnClean(false);
                _suspend = false;
                return(true);
            }
            return(false);
        }
Ejemplo n.º 3
0
 public bool AddNew()
 {
     if (Save())
     {
         if (_record != null)
         {
             _priorRecord = _record;
         }
         _record  = new TRecord();
         _suspend = true;
         foreach (var action in _setDefaults)
         {
             action.SetControl.Invoke();
             if (action.InvokeSetProperty)
             {
                 action.SetProperty.Invoke(_record);
             }
         }
         NewRecord?.Invoke(this, new EventArgs());
         FirstControl?.Focus();
         ValidationPanel?.SetStatus(RecordStatus.Valid, "New record started");
         ToolStrip?.OnNew();
         _suspend = false;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 4
0
        private void InitializePanels()
        {
            NavigationPanel     = new NavigationPanel(ProjectManager);
            ViewportPanel       = new ViewportPanel(ProjectManager);
            ValidationPanel     = new ValidationPanel(ProjectManager);
            PropertiesPanel     = new PartPropertiesPanel(ProjectManager);
            DetailPanel         = new ElementDetailPanel(ProjectManager);
            StudConnectionPanel = new StudConnectionPanel(ProjectManager);

            ViewportPanel.Show(DockPanelControl, DockState.Document);
            StudConnectionPanel.Show(DockPanelControl, DockState.Document);
            ViewportPanel.Activate();

            DockPanelControl.DockLeftPortion = 250;
            NavigationPanel.Show(DockPanelControl, DockState.DockLeft);

            DockPanelControl.DockWindows[DockState.DockBottom].BringToFront();
            DockPanelControl.DockBottomPortion = 230;

            PropertiesPanel.Show(DockPanelControl, DockState.DockBottom);
            DetailPanel.Show(PropertiesPanel.Pane, null);
            ValidationPanel.Show(PropertiesPanel.Pane, null);

            PropertiesPanel.Activate();
        }
Ejemplo n.º 5
0
        private void Edit_GenerateFilesMenu_Click(object sender, EventArgs e)
        {
            if (CurrentProject != null)
            {
                if (ProjectManager.IsValidatingProject || ProjectManager.IsGeneratingFiles)
                {
                    return;
                }

                if (!ProjectManager.IsPartValidated)
                {
                    GenerateFileAfterValidation = true;
                    ProjectManager.ValidateProject();
                    ValidationPanel.Activate();
                    return;
                }
                else if (!ProjectManager.IsPartValid)
                {
                    ValidationPanel.Activate();
                    return;
                }

                ProjectManager.GenerateLddFiles(SettingsManager.Current.BuildSettings.GenerateOutlines);
            }
        }
        private void Edit_ValidatePartMenu_Click(object sender, EventArgs e)
        {
            if (ProjectManager.IsValidatingProject || ProjectManager.IsGeneratingFiles)
            {
                return;
            }

            ProjectManager.ValidateProject();
            ValidationPanel.Activate();
        }
Ejemplo n.º 7
0
 public bool Validate()
 {
     using (var cn = _db.GetConnection())
     {
         cn.Open();
         string       message;
         RecordStatus status = (_record.IsValid(cn, out message)) ? RecordStatus.Editing : RecordStatus.Invalid;
         ValidationPanel?.SetStatus(status, message ?? "Record has no errors");
         return(status == RecordStatus.Valid);
     }
 }
 private void ProjectManager_GenerationFinished(object sender, ProjectBuildEventArgs e)
 {
     //TODO: localize and improve messages
     if (e.Successful)
     {
         ProjectManager.SaveGeneratedPart(e.Result, SelectedBuildConfig);
     }
     else
     {
         MessageBox.Show("An error occured.");
         ValidationPanel.Activate();
         ValidationPanel.ShowBuildMessages(e.Messages);
     }
 }
Ejemplo n.º 9
0
        private void Setup(StateMachineContext.Events expectedEvents, StateMachineContext.ProcessState state)
        {
            Setup(expectedEvents);
            m_ContentTabControl.Items.Clear();
            switch (state)
            {
            case StateMachineContext.ProcessState.SetupDataDialog:
                m_ContentTabControl.Items.Add(SetupDataDialogPanel);
                SetupSetupDialog();
                UpdateProgressBar(1);
                SetupDataDialogPanel.Focus();
                break;

            case StateMachineContext.ProcessState.Validation:
                m_ContentTabControl.Items.Add(ValidationPanel);
                UpdateProgressBar(2);
                ValidationPanel.Focus();
                SetupValidationDialog();

                //m_ValidationListBox.Items.Clear();
                //m_ValidationPropertyGrid.SelectedObject = m_ApplicationState.Wrapper;
                //m_ValidationPropertyGrid.Text = Properties.Resources.InstallationProperties;
                break;

            case StateMachineContext.ProcessState.Installation:
                m_ContentTabControl.Items.Add(InstallationPanel);
                UpdateProgressBar(3);
                InstallationPanel.Focus();
                InstallationProgressBar.Minimum = 0;
                InstallationProgressBar.Maximum = 10;
                InstallationListBox.AddMessage("Starting installation - it could take several minutes.");
                break;

            case StateMachineContext.ProcessState.Finisched:
                m_ContentTabControl.Items.Add(FinischedPanel);
                UpdateProgressBar(4);
                FinischedPanel.Focus();
                break;

            case StateMachineContext.ProcessState.Uninstall:
                m_ContentTabControl.Items.Add(UninstallPanel);
                UpdateProgressBar(4);
                UninstallPanel.Focus();
                break;
            }
            this.UpdateLayout();
        }
Ejemplo n.º 10
0
        public bool Save()
        {
            // get the textboxes with changes that haven't fired Validated event
            var unvalidatedTextboxes = _textChanges.Where(kp => kp.Value && !_validated[kp.Key]).Select(kp => kp.Key).ToList();

            foreach (var tb in unvalidatedTextboxes)
            {
                _textBoxValidators[tb].Validated.Invoke(this, new EventArgs());
            }

            if (_suspend)
            {
                return(true);
            }
            _suspend = true;

            try
            {
                if (IsDirty)
                {
                    SavingRecord?.Invoke(this, new EventArgs());
                    _db.Save(_record);
                    IsDirty = false;
                    RecordSaved?.Invoke(this, new EventArgs());
                    ValidationPanel?.SetStatus(RecordStatus.Valid, "Record saved");
                }
                return(true);
            }
            catch (Exception exc)
            {
                ValidationPanel?.SetStatus(RecordStatus.Invalid, exc.Message);

                if (MessageBox.Show($"The record could not be saved: {exc.Message}\r\nClick OK to try again or Cancel to lose your changes.", "Save Error", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                {
                    UndoChanges();
                    return(true);
                }
                return(false);
            }
            finally
            {
                _suspend = false;
            }
        }
Ejemplo n.º 11
0
        private void LoadDefaultLayout()
        {
            foreach (var content in DockPanelControl.Contents.ToArray())
            {
                content.DockHandler.DockPanel = null;
            }

            try
            {
                var layoutStream = ResourceHelper.GetResourceStream("DefaultLayout.xml");
                if (layoutStream != null)
                {
                    DockPanelControl.LoadFromXml(layoutStream, DockContentLoadingHandler);
                }
                return;
            }
            catch { }

            ViewportPanel.Show(DockPanelControl, DockState.Document);

            StudConnectionPanel.Show(DockPanelControl, DockState.Document);

            ViewportPanel.Activate();

            DockPanelControl.DockLeftPortion = 250;

            NavigationPanel.Show(DockPanelControl, DockState.DockLeft);

            DockPanelControl.DockWindows[DockState.DockBottom].BringToFront();
            DockPanelControl.DockBottomPortion = 250;

            PropertiesPanel.Show(DockPanelControl, DockState.DockBottom);

            DetailPanel.Show(PropertiesPanel.Pane, null);

            ConnectionPanel.Show(PropertiesPanel.Pane, null);

            ValidationPanel.Show(PropertiesPanel.Pane, null);

            InfoPanel.Show(PropertiesPanel.Pane, null);
        }