Exemplo n.º 1
0
 public void Apply(ElectroliteOptions options)
 {
     _form.Text        = options.Title;
     _form.MinimizeBox = options.MinButton;
     _form.MaximizeBox = options.MaxButton;
     _form.Size        = GetSize(options.Size);
     if (options.MinSize != null)
     {
         _form.MinimumSize = ConvertSize(options.MinSize);
     }
     if (options.MaxSize != null)
     {
         _form.MaximumSize = ConvertSize(options.MaxSize);
     }
     _form.ShowInTaskbar = options.ShownInTaskbar;
     _form.ShowIcon      = options.ShowIcon;
     if (string.IsNullOrEmpty(options.IconPath))
     {
         _form.Icon = LoadIcon("Electrolite.Windows.Main.favicon.ico");
     }
     else
     {
         _form.Icon = new Icon(options.IconPath);
     }
 }
Exemplo n.º 2
0
 public Order ModifyOptions(ElectroliteOptions options)
 {
     return(IpcExtensions.WrapOrder(() =>
     {
         Form.ApplySettings(options);
     }));
 }
Exemplo n.º 3
0
 public Order ModifyOptions(ElectroliteOptions options)
 {
     return(IpcExtensions.WrapOrder(() =>
     {
         ModifyOptionsSafe(options);
     }));
 }
Exemplo n.º 4
0
 private void ModifyOptionsSafe(ElectroliteOptions options)
 {
     if (Form.InvokeRequired)
     {
         Form.Invoke(new ModifyOptionsDelegate(ModifyOptionsSafe), new object[] { options });
     }
     else
     {
         Form.ApplySetttings(options);
     }
 }
Exemplo n.º 5
0
        public IpcSession(IIpcPlatformAdapter adapter, Uri url, ElectroliteOptions options)
        {
            _adapter       = adapter;
            Url            = url;
            StartupOptions = options;
            var processId = Process.GetCurrentProcess().Id;

            _duplex = new IpcPipeDuplex <IBrowserHost, IBrowserWindow>(new IpcDuplexParameters <IBrowserHost>
            {
                ClientPipe     = ElectroliteCommon.ElectroliteBrowser(processId),
                ServerEndpoint = ElectroliteCommon.ElectroliteHostEndpoint(processId),
                ServerPipe     = ElectroliteCommon.ElectroliteHost(processId),
                ServerFactory  = provider => new BrowserHost(this)
            });
            _source      = new CancellationTokenSource();
            _startWaiter = new TaskCompletionSource <bool>();
        }
Exemplo n.º 6
0
        public static async Task Main()
        {
            Console.WriteLine("Current directory:");
            Console.WriteLine(Directory.GetCurrentDirectory());
            var options = new ElectroliteOptions
            {
                Title = "Sample Electrolite app"
            };
            var url = new Uri(MyUrl);

            using (var session = ElectroliteApp.CreateSession(url, options))
            {
                session.SplashImagePath  = GetIncludedImageFullPath("SampleSplash.jpg");
                session.BackgroundError += ((sender, args) =>
                {
                    Console.WriteLine(args.Exception.ToString());
                });
                session.RunBackground();
                await session.WaitForShutdown();
            }
            Environment.Exit(0);
        }
Exemplo n.º 7
0
        public void Apply(ElectroliteOptions options)
        {
            if (options.Size != null)
            {
                _form.Size = new Size(options.Size.Width, options.Size.Height);
            }

            if (options.MinSize != null)
            {
                _form.MinimumSize = new Size(options.MinSize.Width, options.MinSize.Height);
            }

            _form.Title         = options.Title;
            _form.Minimizable   = options.MinButton;
            _form.Maximizable   = options.MaxButton;
            _form.ShowInTaskbar = options.ShownInTaskbar;

            if (!string.IsNullOrEmpty(options.IconPath))
            {
                _form.Icon = new Icon(options.IconPath);
            }
        }
Exemplo n.º 8
0
 public void ApplySetttings(ElectroliteOptions options)
 {
     _painter.Apply(options);
 }
Exemplo n.º 9
0
        public static ISession CreateSession(Uri url, ElectroliteOptions options)
        {
            var adapter = PlatformFactory.CreateAdapter();

            return(adapter.CreateSession(url, options));
        }
Exemplo n.º 10
0
 public ISession CreateSession(Uri url, ElectroliteOptions options)
 {
     return(new IpcSession(this, url, options));
 }
Exemplo n.º 11
0
 public async Task ModifySettings(ElectroliteOptions options)
 {
     await _duplex.Client.OrderAsync(x => x.ModifyOptions(options));
 }