Example #1
0
        //-----------------------------------------------------------------------------------------
        // Méthodes
        //-----------------------------------------------------------------------------------------
        #region Methods
        private void OpenProject()
        {
            editor.App app = Application.Current as editor.App;
            MainWindow wnd = app.MainWindow as MainWindow;

            OpenFileDialog dlg = new OpenFileDialog();

            // Set filter for file extension and default file extension
            dlg.DefaultExt = ".prj";
            dlg.Filter     = "Projet Syntaxi (.prj)|*.prj";

            // Get the selected file name and display in a TextBox
            if (dlg.ShowDialog() == true)
            {
                try
                {
                    app.OpenProject(dlg.FileName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(app.MainWindow, "Impossible de charger le projet.\n" + ex.Message, "Oups", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }
            }
            else
            {
                return;
            }

            //
            View.VueEditor view = new View.VueEditor();
            view.DataContext = new ModelView.VueEditor();
            wnd.ChangeView(view);
        }
Example #2
0
        private void NewProject()
        {
            editor.App app = Application.Current as editor.App;
            MainWindow wnd = app.MainWindow as MainWindow;

            // dossier d'enregistrement
            SaveFileDialog dlg = new SaveFileDialog();

            // Set filter for file extension and default file extension
            dlg.DefaultExt = ".prj";
            dlg.Filter     = "Projet Syntaxi|*.prj";

            // Get the selected file name and display in a TextBox
            if (dlg.ShowDialog() != true)
            {
                return;
            }

            app.ProjectFileName = dlg.FileName;

            // Initialise le projet
            switch (selProjectType)
            {
            /*case "c#":
             *  app.Project = new Project(projectName, projectVersion);
             *  app.appModel.AddCSharpSyntax();
             *  app.editorModel.CreateModel();
             *  app.editorModel.AddCSharpStates();
             *  break;*/
            case "c++":
                app.Project = new Project(projectName, projectVersion);
                app.appModel.AddCppSyntax();
                app.editorModel.CreateModel();
                app.editorModel.AddCppStates();
                break;

            case "empty":
                app.Project = new Project(projectName, projectVersion);
                app.editorModel.CreateModel();
                break;
            }

            //
            View.VueEditor view = new View.VueEditor();
            view.DataContext = new ModelView.VueEditor();
            wnd.ChangeView(view);
        }