예제 #1
0
        public MainWindow()
        {
            InitializeComponent();

            Init();


            sc_document = new SourcecodeDocument(this, txtCode);

            DispatcherTimer itimer = new DispatcherTimer(DispatcherPriority.ApplicationIdle);

            itimer.Tick += (s, e) => onIdle();
            itimer.Start();
        }
예제 #2
0
        private void OpenExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            if (controller != null && (controller.Mode == PICControllerMode.WAITING || controller.Mode == PICControllerMode.FINISHED))
            {
                controller = null;
            }

            bool isLST;

            sc_document.AskSaveIfDirty();

            sc_document = SourcecodeDocument.OpenNew(this, txtCode, out isLST) ?? sc_document;

            if (isLST)
            {
                if (!sc_document.Save())
                {
                    return;
                }

                string resultPath = Path.Combine(Path.GetDirectoryName(sc_document.Path), Path.GetFileNameWithoutExtension(sc_document.Path) + ".lst");

                if (File.Exists(resultPath))
                {
                    var cmds = PICProgramLoader.LoadFromFile(resultPath);

                    if (cmds == null)
                    {
                        MessageBox.Show("Error while reading compiled file.");
                        sc_document.MakeDirty();
                        return;
                    }

                    controller = new PICController(cmds, getSimuSpeedFromComboBox());
                    controller.RaiseCompleteEventResetChain();
                    stackList.Reset();
                    IconBar.Reset();
                }
            }
        }
예제 #3
0
        private void NewExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            sc_document.AskSaveIfDirty();

            sc_document = new SourcecodeDocument(this, txtCode);
        }