Beispiel #1
0
        public static void Main(string[] args)
        {
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            Application.ThreadException += OnException;
            try {
                var strings = args;
                if (args.Length > 4 && args[0] == "d")
                {
                    MessageBox.Show(
                        $"Attach to {Path.GetFileName(AppDomain.CurrentDomain.SetupInformation.ApplicationBase)}");
                    strings = args.Skip(1).ToArray();
                }
                var pathInfo = new PathInfo(strings);
                Tracing.Tracer.LogSeparator("PathInfo");
                Tracing.Tracer.LogText(pathInfo.ToString());
                Tracing.Tracer.LogSeparator("PathInfo");
                CheckAssemblyFile(pathInfo);
                var modelControllerBuilder    = new ModelControllerBuilder();
                var settingsStorageOnRegistry = new SettingsStorageOnRegistry(@"Software\Developer Express\eXpressApp Framework\Model Editor");
                var modelEditorViewController = modelControllerBuilder.GetController(pathInfo);
                Tracing.Tracer.LogText("modelEditorViewController");
                WinSimpleActionBinding.Register();
                WinSingleChoiceActionBinding.Register();
                WinParametrizedActionBinding.Register();
                PopupWindowShowActionBinding.Register();
                _modelEditorForm           = new ModelEditorForm(modelEditorViewController, settingsStorageOnRegistry);
                _modelEditorForm.Disposed += (sender, eventArgs) => ((IModelEditorSettings)sender).ModelEditorSaveSettings();
                _modelEditorForm.SetCaption(Path.GetFileName(pathInfo.LocalPath));

                Application.Run(_modelEditorForm);
            } catch (Exception exception) {
                HandleException(exception);
            }
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            var iconName = typeof(MainClass).Assembly.GetManifestResourceNames().First(s => s.EndsWith("ExpressApp.ico"));
            var manifestResourceStream = typeof(MainClass).Assembly.GetManifestResourceStream(iconName);
            var icon = new Icon(manifestResourceStream ?? throw new InvalidOperationException());

            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            Application.ThreadException += OnException;
            SplashScreen splashScreen = null;

            try {
                var strings = args;
                if (args.Length > 4 && args[0] == "d")
                {
                    MessageBox.Show(
                        $"Attach to {Path.GetFileName(AppDomain.CurrentDomain.SetupInformation.ApplicationBase)}");
                    strings = args.Skip(1).ToArray();
                }

                DesignerOnlyCalculator.IsRunFromDesigner = true;
                splashScreen = new SplashScreen();
                splashScreen.Start();
                var pathInfo = new PathInfo(strings);
                Tracing.Tracer.LogSeparator("PathInfo");
                Tracing.Tracer.LogText(pathInfo.ToString());
                Tracing.Tracer.LogSeparator("PathInfo");
                CheckAssemblyFile(pathInfo);
                var modelControllerBuilder    = new ModelControllerBuilder();
                var settingsStorageOnRegistry = new SettingsStorageOnRegistry(@"Software\Developer Express\eXpressApp Framework\Model Editor");
                var modelEditorViewController = modelControllerBuilder.GetController(pathInfo);
                Tracing.Tracer.LogText("modelEditorViewController");
                WinSimpleActionBinding.Register();
                WinSingleChoiceActionBinding.Register();
                WinParametrizedActionBinding.Register();
                PopupWindowShowActionBinding.Register();
                _modelEditorForm           = new ModelEditorForm(modelEditorViewController, settingsStorageOnRegistry);
                _modelEditorForm.Shown    += (sender, eventArgs) => splashScreen?.Stop();
                _modelEditorForm.Disposed += (sender, eventArgs) => ((IModelEditorSettings)sender)?.ModelEditorSaveSettings();
                _modelEditorForm.SetCaption($"{Path.GetFileNameWithoutExtension(pathInfo.AssemblyPath)}/{Path.GetFileName(pathInfo.LocalPath)}");
                _modelEditorForm.Icon = icon;
                Application.Run(_modelEditorForm);
            } catch (Exception exception) {
                HandleException(exception);
            }
            finally {
                splashScreen?.Stop();
            }
        }