Esempio n. 1
0
        static void Main(string[] args)
        {
            var app = Carlo.Launch(new Options());

            app.ServeFolder("./wwwroot");

            app.Load("index.html");

            app.Exit += OnAppExit;

            var thread = new Thread((s) =>
            {
                while (true)
                {
                    app.MainWindow?.SendIpcMessageAsync("message-from-csharp", DateTime.Now.ToString());

                    Thread.Sleep(1000);
                }
            });

            thread.IsBackground = true;
            thread.Start();

            _exitEvent.WaitOne();
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            var app = Carlo.Launch(new Options()
            {
                Title   = "Carlo# - Angular",
                Width   = 1024,
                Height  = 600,
                Channel = new string[] { "*" }
            });

            var controller = new WeatherForecastController(app.MainWindow);

            app.ServeFolder("./wwwroot/dist");

            app.Load("index.html");

            app.Exit += OnAppExit;

            _exitEvent.WaitOne();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            _app = Carlo.Launch(new Options()
            {
                Title   = "Photobooth",
                Width   = 800,
                Height  = 648 + 24,
                Channel = new string[] { "canary" }
            });

            _app.ServeFolder("./www");

            _app.ExposeFunctionAsync <string, JObject>("saveImage", SaveImage).Wait();

            _app.Load("index.html");

            _app.Exit += OnAppExit;

            _exitEvent.WaitOne();
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            var app = Carlo.Launch(new Options()
            {
                BgColor = Color.FromArgb(0x2b, 0x2e, 0x3b),
                Title   = "Carlo# - Systeminfo App",
                Width   = 1000,
                Height  = 500,
                Channel = new string[] { "canary", "stable" },
                Icon    = "./app_icon.png",
            });

            app.ServeFolder("./www");

            app.ExposeFunctionAsync("systeminfo", GetSystemInfo).Wait();

            app.Load("index.html");

            app.Exit += OnAppExit;

            _exitEvent.WaitOne();
        }
Esempio n. 5
0
        public static void Main(string[] args)
        {
            _host = CreateWebHostBuilder(args).Build();

            var runTask = _host.RunAsync();

            var app = Carlo.Launch(new Options()
            {
                Title   = "Carlo# - Angular with hot reload",
                Width   = 1024,
                Height  = 600,
                Channel = new string[] { "stable" }
            });

            app.Exit += App_OnExit;

            app.ServeOrigin("https://localhost:5001");

            app.LoadAsync("index.html").Wait();

            runTask.Wait();
        }
Esempio n. 6
0
        private List <List <double> > RunCarlo(Breakdown breakdown, PDFType pdf)
        {
            Ziggurat zigg;

            switch (pdf)
            {
            case PDFType.Normal:
                zigg = Startup.normalZigg;
                break;

            case PDFType.Laplace:
                zigg = Startup.laplaceZigg;
                break;

            case PDFType.T:
                zigg = Startup.tZigg;
                break;

            default:
                zigg = Startup.normalZigg;
                break;
            }

            Carlo carlo = Task.Run(() => new Carlo(breakdown.expectedReturn, breakdown.volatility, asset.yearsOfAdd + asset.yearsOfWith, zigg)).Result;
            List <List <double> > rates = new List <List <double> >(carlo.rates.Count);
            List <double>         rate;

            for (int i = 0; i < carlo.rates.Count; i++)
            {
                rate = new List <double>(carlo.rates[i].Count);
                for (int j = 0; j < carlo.rates[i].Count; j++)
                {
                    rate.Add(carlo.rates[i][j] * breakdown.portfolioWeight);
                }
                rates.Add(rate);
            }
            return(rates);
        }