コード例 #1
0
ファイル: GenAndAsm.cs プロジェクト: theotherside/6502bench
        /// <summary>
        /// Populates the assembler combo box.  Attempts to match the defaultAsm arg with
        /// the entries to configure the initial value.
        /// </summary>
        private void PopulateAssemblerComboBox(string defaultAsm)
        {
            //assemblerComboBox.DisplayMember = "Name";   // show this property

            assemblerComboBox.Items.Clear();
            IEnumerator <AssemblerInfo> iter = AssemblerInfo.GetInfoEnumerator();
            bool foundMatch = false;

            while (iter.MoveNext())
            {
                AssemblerInfo    info    = iter.Current;
                AssemblerVersion version = AssemblerVersionCache.GetVersion(info.AssemblerId);
                AsmComboItem     item    = new AsmComboItem(info, version);
                assemblerComboBox.Items.Add(item);
                if (item.AssemblerId.ToString() == defaultAsm)
                {
                    Debug.WriteLine("matched current " + defaultAsm);
                    assemblerComboBox.SelectedItem = item;
                    foundMatch = true;
                }
            }
            if (!foundMatch)
            {
                // Need to do this or box will show empty.
                assemblerComboBox.SelectedIndex = 0;
            }
        }
コード例 #2
0
ファイル: GenAndAsm.cs プロジェクト: theotherside/6502bench
        private void generateButton_Click(object sender, EventArgs e)
        {
            IGenerator gen = AssemblerInfo.GetGenerator(mSelectedAssemblerId);

            if (gen == null)
            {
                Debug.WriteLine("Unable to get generator for " + mSelectedAssemblerId);
                return;
            }
            gen.Configure(mProject, mWorkDirectory, mBaseFileName,
                          AssemblerVersionCache.GetVersion(mSelectedAssemblerId), AppSettings.Global);

            GeneratorProgress dlg = new GeneratorProgress(gen);

            dlg.ShowDialog();
            Debug.WriteLine("Dialog returned: " + dlg.DialogResult);

            List <string> pathNames = dlg.Results;

            dlg.Dispose();

            if (pathNames == null)
            {
                // errors already reported
                return;
            }

            ResetElements();
            mGenerationResults = pathNames;
            previewFileComboBox.Items.Clear();
            foreach (string str in pathNames)
            {
                previewFileComboBox.Items.Add(new ComboPath(str));
            }
            previewFileComboBox.SelectedIndex = 0;      // should trigger update

            UpdateAssemblerControls();
        }