Exemplo n.º 1
0
        public void New_Host(string osmfilepath, string cpcfilepath)
        {
            try
            {
                _formCount += 1;
                HostC       = _hostSurfaceManager.GetNewHost(typeof(Form), Host.LoaderType.BasicDesignerLoader);

                HostC.Parent = _Panel1;
                HostC.Dock   = DockStyle.Fill;
                //  _hostSurfaceManager.AddService(typeof(IToolboxService), Home.m_toolbox.toolbox1);
                //  _hostSurfaceManager.AddService(typeof(PropertyGrid), Home.m_propertyWindow.propertyGrid);
                metroFichierXml.Text    = osmfilepath;
                metroFichierCCPlus.Text = cpcfilepath;
                ToolBox.Window b1 = (ToolBox.Window)HostC.CreateControl(typeof(ToolBox.Window), new Size(50, 50), new Point(10, 10));

                b1.Dock = DockStyle.Fill;
                var    currentHostControl = HostC;
                string stringXML          = ((Loader.BasicHostLoader)currentHostControl.HostSurface.Loader).GetCode();
                ModuleCpcDosCplus.GenTextCpc(stringXML);
                //GenTextCpc(stringXML);
                string code = ((Loader.BasicHostLoader)currentHostControl.HostSurface.Loader).GetCode();
                //FastColoredTextBox1.Text = code;
                //tb.Text = WinToCpcDosCplus.ModuleCpcDosCplus.tbS;
                string fileName   = metroFichierXml.Text;
                string codeccplus = WinToCpcDosCplus.ModuleCpcDosCplus.tbS;
                string fileNameC  = metroFichierCCPlus.Text;

                if (string.IsNullOrEmpty(metroFichierXml.Text))
                {
                    var dlgSaveFile = new SaveFileDialog();
                    dlgSaveFile.Filter = "Fichier OSMaker (.*osm)|*.osm";
                    if (dlgSaveFile.ShowDialog() == DialogResult.OK)
                    {
                        fileName             = dlgSaveFile.FileName;
                        metroFichierXml.Text = fileName;
                        if (fileName.Length != 0)
                        {
                        }
                    }
                }
                else
                {
                    fileName = metroFichierXml.Text;
                }

                if (string.IsNullOrEmpty(metroFichierXml.Text))
                {
                    MessageBox.Show("Pas de chemin de fichier OSMaker renseigné, enregistrement impossible !");
                }
                else
                {
                    File.WriteAllText(metroFichierXml.Text, code);
                }
                if (string.IsNullOrEmpty(metroFichierCCPlus.Text))
                {
                    var dlgSaveFile = new SaveFileDialog();
                    dlgSaveFile.Filter = "Fichier CPC (.*cpc)|*.cpc";
                    if (dlgSaveFile.ShowDialog() == DialogResult.OK)
                    {
                        fileNameC = dlgSaveFile.FileName;
                        metroFichierCCPlus.Text = fileNameC;
                        if (fileNameC.Length != 0)
                        {
                        }
                    }
                }
                else
                {
                    fileNameC = metroFichierCCPlus.Text;
                }

                if (string.IsNullOrEmpty(metroFichierCCPlus.Text))
                {
                    MessageBox.Show("Pas de chemin de fichier CpcdosC+ renseigné, enregistrement impossible !");
                }
                else
                {
                    File.WriteAllText(metroFichierCCPlus.Text, codeccplus);
                }
            }
            catch
            {
                MessageBox.Show("Error in creating new host", "OSMaker IUG Conceptor", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        public void Save()
        {
            var    currentHostControl = HostC;
            string stringXML          = ((Loader.BasicHostLoader)currentHostControl.HostSurface.Loader).GetCode();

            ModuleCpcDosCplus.GenTextCpc(stringXML);
            //GenTextCpc(stringXML);
            string code = ((Loader.BasicHostLoader)currentHostControl.HostSurface.Loader).GetCode();

            //FastColoredTextBox1.Text = code;
            //tb.Text = WinToCpcDosCplus.ModuleCpcDosCplus.tbS;
            if (metroFichierCCPlus.Text == "")
            {
                metroFichierCCPlus.Text = metroFichierXml.Text.Replace(".osm", ".cpc");
            }

            string fileName   = metroFichierXml.Text;
            string codeccplus = WinToCpcDosCplus.ModuleCpcDosCplus.tbS;
            string fileNameC  = metroFichierCCPlus.Text;

            if (string.IsNullOrEmpty(metroFichierXml.Text))
            {
                var dlgSaveFile = new SaveFileDialog();
                dlgSaveFile.Filter = "Fichier OSMaker (.*osm)|*.osm";
                if (dlgSaveFile.ShowDialog() == DialogResult.OK)
                {
                    fileName             = dlgSaveFile.FileName;
                    metroFichierXml.Text = fileName;
                    if (fileName.Length != 0)
                    {
                    }
                }
            }
            else
            {
                fileName = metroFichierXml.Text;
            }

            if (string.IsNullOrEmpty(metroFichierXml.Text))
            {
                MessageBox.Show("Pas de chemin de fichier OSMaker renseigné, enregistrement impossible !");
            }
            else
            {
                File.WriteAllText(metroFichierXml.Text, code);
            }
            if (string.IsNullOrEmpty(metroFichierCCPlus.Text))
            {
                var dlgSaveFile = new SaveFileDialog();
                dlgSaveFile.Filter = "Fichier CPC (.*cpc)|*.cpc";
                if (dlgSaveFile.ShowDialog() == DialogResult.OK)
                {
                    fileNameC = dlgSaveFile.FileName;
                    metroFichierCCPlus.Text = fileNameC;
                    if (fileNameC.Length != 0)
                    {
                    }
                }
            }
            else
            {
                fileNameC = metroFichierCCPlus.Text;
            }

            if (string.IsNullOrEmpty(metroFichierCCPlus.Text))
            {
                MessageBox.Show("Pas de chemin de fichier CpcdosC+ renseigné, enregistrement impossible !");
            }
            else
            {
                File.WriteAllText(metroFichierCCPlus.Text, codeccplus);
            }
        }