Exemplo n.º 1
0
        public NativeWindow(ChromelyConfiguration config)
        {
            _nativeHost = NativeHostFactory.GetNativeHost(config);
            _config     = config;
            Handle      = IntPtr.Zero;

            _nativeHost.Created     += OnCreated;
            _nativeHost.Moving      += OnMoving;
            _nativeHost.SizeChanged += OnSizeChanged;
            _nativeHost.Close       += OnClose;
        }
Exemplo n.º 2
0
        public NativeWindow(IChromelyNativeHost nativeHost, IChromelyConfiguration config)
        {
            _config     = config;
            _nativeHost = nativeHost;
            if (_nativeHost == null)
            {
                _nativeHost = NativeHostFactory.GetNativeHost(_config);
            }

            Handle = IntPtr.Zero;

            _nativeHost.Created     += OnCreated;
            _nativeHost.Moving      += OnMoving;
            _nativeHost.SizeChanged += OnSizeChanged;
            _nativeHost.Close       += OnClose;
        }
Exemplo n.º 3
0
        public virtual void Initialize(IServiceCollection container, IChromelyAppSettings appSettings, IChromelyConfiguration config, IChromelyLogger chromelyLogger)
        {
            EnsureExpectedWorkingDirectory();

            #region Container

            _container = container;
            if (_container == null)
            {
                _container = new ServiceCollection();
            }

            #endregion

            #region Configuration

            if (config == null)
            {
                var configurator = new ConfigurationHandler();
                config = configurator.Parse <DefaultConfiguration>();
            }

            if (config == null)
            {
                config = DefaultConfiguration.CreateForRuntimePlatform();
            }

            InitConfiguration(config);
            config.Platform = ChromelyRuntime.Platform;

            #endregion

            #region Application/User Settings

            if (appSettings == null)
            {
                appSettings = new DefaultAppSettings(config.AppName);
            }

            var currentAppSettings = new CurrentAppSettings();
            currentAppSettings.Properties = appSettings;
            ChromelyAppUser.App           = currentAppSettings;
            ChromelyAppUser.App.Properties.Read(config);

            #endregion

            #region Logger

            if (chromelyLogger == null)
            {
                chromelyLogger = new SimpleLogger();
            }

            var defaultLogger = new DefaultLogger();
            defaultLogger.Log = chromelyLogger;
            Logger.Instance   = defaultLogger;

            #endregion

            // Register all primary objects
            _container.AddSingleton <IChromelyContainer>(new ChromelyServiceCollectionContainer(_container));
            _container.AddSingleton(_container);
            _container.AddSingleton(appSettings);
            _container.AddSingleton(config);
            _container.AddSingleton(chromelyLogger);
            _container.AddSingleton(NativeHostFactory.GetNativeHost(config));
            _container.AddChromelyMvcWithDefaultRoutes();
        }
 public ChromelyWindow(IChromelyNativeHost nativeHost, IChromelyContainer container, IChromelyConfiguration config, IChromelyRequestTaskRunner requestTaskRunner, IChromelyCommandTaskRunner commandTaskRunner)
     : base(nativeHost ?? NativeHostFactory.GetNativeHost(config), container, config, requestTaskRunner, commandTaskRunner)
 {
 }
Exemplo n.º 5
0
        public static void MessageBox(ChromelyConfiguration config, string message, MessageType messageType = MessageType.Error)
        {
            var nativeGui = NativeHostFactory.GetNativeHost(config);

            nativeGui.MessageBox(message, messageType);
        }