Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssetEditor" /> class.
        /// </summary>
        /// <param name="assetManagerFactory">The asset manager factory.</param>
        /// <param name="viewFactory">The view factory.</param>
        /// <param name="drawerFactory">The drawer factory.</param>
        /// <param name="paletFactory">The palet factory.</param>
        /// <param name="previewBarFactory">The preview bar factory.</param>
        /// <param name="fileLocationProvider">The file location provider.</param>
        public AssetEditor(
            AssetManagerFactory assetManagerFactory,
            ViewFactory viewFactory,
            DrawerFactory drawerFactory,
            PaletFactory paletFactory,
            PreviewBarFactory previewBarFactory,
            FileLocationProvider fileLocationProvider)
        {
            this.InitializeComponent();
            this.viewFactory          = viewFactory;
            this.drawerFactory        = drawerFactory;
            this.paletFactory         = paletFactory;
            this.previewBarFactory    = previewBarFactory;
            this.fileLocationProvider = fileLocationProvider;
            this.assetManager         = assetManagerFactory.Get(this.fileLocationProvider.AssetFile, false);
            this.palet      = this.paletFactory.Get(this.PaletPanel);
            this.drawer     = this.drawerFactory.Get(this.DrawerPanel);
            this.previewBar = this.previewBarFactory.Get(this.PreviewBar);

            this.ButtonSize.Value = Settings.Default.ZoomLevel;

            // Event handler setup must precede loading assets but happen after the asset manager is created
            this.SetupEventHandlers();

            // Load assets and trigger events.
            this.assetManager.LoadAssets();

            if (this.assetManager.CurrentAsset != null)
            {
                this.previewBar.Draw(this.assetManager.CurrentAsset.Shapes);
            }
        }
Esempio n. 2
0
        static void Main()
        {
            // Add handler to handle the exception raised by main threads
            Application.ThreadException +=
                new ThreadExceptionEventHandler(Application_ThreadException);

            // Add handler to handle the exception raised by additional threads
            AppDomain.CurrentDomain.UnhandledException +=
                new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm(AssetManagerFactory.GetAssetManager()));
        }