Beispiel #1
0
        public AssemblyTextBox(AssemblyFileViewModel avm,
                               PreferencesViewModel preferences) :
            this()
        {
            m_ViewModel = avm;
            m_ViewModel.FileErrors.CollectionChanged += OnFileErrorsChanged;

            preferencesViewModelBindingSource.DataSource  = preferences;
            assemblyFileViewModelBindingSource.DataSource = avm;
            m_FileTxtBox.SetHighlighting("Assembly");
        }
Beispiel #2
0
        private TabPage CreateNewTabPage(AssemblyFileViewModel viewModel)
        {
            var newTab = new TabPage();

            newTab.DataBindings.Add(new Binding(nameof(newTab.Text), viewModel, nameof(viewModel.FileName)));
            var tabContent = new FileEditor(viewModel, m_Preferences)
            {
                Dock = DockStyle.Fill
            };

            newTab.Controls.Add(tabContent);
            AreAnyFilesOpened = (m_EditorVm.AllOpenFiles.Count > 0);

            return(newTab);
        }
 public FileEditor(AssemblyFileViewModel avm,
                   PreferencesViewModel preferences) :
     this()
 {
     this.RecursiveRemove(m_FileTxt);
     m_FileTxt.Dispose();
     m_FileTxt = new AssemblyTextBox(avm, preferences)
     {
         BackColor = Color.DarkSalmon,
         Dock      = DockStyle.Fill,
         Location  = new Point(0, 0),
         Name      = "m_FileTxt",
         Size      = new Size(369, 204),
         TabIndex  = 0
     };
     splitContainer1.Panel1.Controls.Add(m_FileTxt);
     m_LoggerTxtBox.DataBindings.Add(new Binding(nameof(m_LoggerTxtBox.Text), avm.Logger, nameof(avm.Logger.LogText)));
 }
Beispiel #4
0
        private void AssembleActiveFileAction(OutputTypes outputType)
        {
            AssemblyFileViewModel viewModel = m_EditorVm.ActiveFile;
            bool continueAssembling         = true;

            if (!viewModel.IsFileBackedPhysically)
            {
                SaveFileAction();

                // if this is still false, the user may have backed out of the save box.
                if (!viewModel.IsFileBackedPhysically)
                {
                    continueAssembling = false;
                }
            }
            else if (viewModel.AreAnyChangedUnsaved)
            {
                string       fileNameNoAsterisk = viewModel.FileName.Substring(0, viewModel.FileName.LastIndexOf('*'));
                DialogResult dr = MessageBox.Show(fileNameNoAsterisk + " has unsaved changes. Do you wish to save before running assembler?",
                                                  "Unsaved Changes",
                                                  MessageBoxButtons.YesNoCancel,
                                                  MessageBoxIcon.Question);

                switch (dr)
                {
                case DialogResult.Yes:
                {
                    SaveFileAction();
                    break;
                }

                case DialogResult.Cancel:
                {
                    continueAssembling = false;
                    break;
                }
                }
            }

            if (continueAssembling)
            {
                Cursor.Current = Cursors.WaitCursor;
                AssemblyCommandParams cmdParams = default(AssemblyCommandParams);
                cmdParams.InputFileName = viewModel.FilePath;
                string fileNoExt = viewModel.FilePath.Substring(0, viewModel.FilePath.LastIndexOf('.'));
                switch (outputType)
                {
                case OutputTypes.DirectBinary:
                {
                    cmdParams.OutputFileName = fileNoExt + ".jef";
                    break;
                }

                case OutputTypes.ELF:
                {
                    cmdParams.OutputFileName = fileNoExt + ".o";
                    break;
                }

                default:
                    System.Diagnostics.Debug.Assert(false);
                    break;
                }

                m_EditorVm.AssembleFileCmd.Execute(cmdParams);
                Cursor.Current = Cursors.Default;
            }
        }