Exemplo n.º 1
0
 internal OperationTransaction(OperationPresenter presenter, bool merge)
 {
     Contract.Requires(presenter != null);
     this.presenter = presenter;
     this.merge = merge;
 }
Exemplo n.º 2
0
        /// <summary>
        /// System.Windows.Application.Startup イベントを発生させます。
        /// </summary>
        /// <param name="e">イベント データを格納している System.Windows.StartupEventArgsです。</param>
        protected override async void OnStartup(StartupEventArgs e)
        {
            string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            ProfileOptimization.SetProfileRoot(path);
            ProfileOptimization.StartProfile("Naya.profile");

            if (!Environment.Is64BitOperatingSystem || !Environment.Is64BitProcess)
            {
                MessageBox.Show("Not Support 32BitOS.");
                Environment.Exit(-1);
            }

            AppDomain.CurrentDomain.UnhandledException +=
                new UnhandledExceptionEventHandler(this.CurrentDomain_UnhandledException);

            // Setup PluginPresenter.
            {
                PluginPresenter pluginPresenter = new PluginPresenter();
                string pluginPath = Path.Combine(path, "Plugins");
                pluginPresenter.Setup(pluginPath);

                this.presenter.AddPluginPresenter(pluginPresenter);
            }

            // Setup LogPresenter
            {
                OutputLogFactory factory = new OutputLogFactory();
                LogPresenter logPresenter = new LogPresenter(factory);
                this.presenter.AddLogPresenter(logPresenter);
            }

            // Setup OperationPresenter
            {
                OperationPresenter operationPresenter = new OperationPresenter();
                this.presenter.AddOperationPresenter(operationPresenter);
            }

            // Setup MenuPresenter
            {
                MenuPresenter menuPresenter = new MenuPresenter();
                this.presenter.AddMenuPresenter(menuPresenter);
            }

            // Setup PanelPresenter
            {
                PanelPresenter panelPresenter = new PanelPresenter();
                this.presenter.AddPanelPresenter(panelPresenter);
            }

            // Setup RepositoryPresenter
            {
                RepositoryPresenter repositoryPresenter = new RepositoryPresenter();
                this.presenter.AddRepositoryPresenter(repositoryPresenter);
            }

            // Setup ScriptPresenter
            {
                PythonScriptBridge scriptBridge = new PythonScriptBridge("Naya");
                ScriptPresenter scriptPresenter = new ScriptPresenter(scriptBridge);
                this.presenter.AddScriptPresenter(scriptPresenter);
            }

            MainWindow window = new MainWindow();
            MainViewModel viewModel = new MainViewModel();

            GlobalPresenter.SetOwner(window);

            window.DataContext = viewModel;
            window.Show();

            window.IsEnabled = false;
            await NayaPresenter.Initialize();

            if (LayoutHelper.HasAvalonDockConfigFile())
            {
                window.LoadLayout();
            }
            else
            {
                GlobalPresenter.MakeDefaultTools();
            }

            window.IsEnabled = true;
        }