Пример #1
0
        static void Main()
        {
            MMirrorManager mm = MMirrorManager.Instance;

            //incase our downloaded data isnt complete, we just get what we last stored
            try
            {
                dynamic manager = JObject.Parse(File.ReadAllText(@"../../Data/tempArray.json"));

                stocks[] stock;
                stock = manager.stock.ToObject <List <stocks> >().ToArray();

                List <weatherDay> weather;
                weather = manager.weather.ToObject <List <weatherDay> >();

                mm.setStock(stock);
                mm.setWeather(weather);
            }
            catch (Exception)
            {
                stockController si = new stockController();
                si.getStockFile();

                weatherController wc = new weatherController(MMirrorManager.instance);
                wc.getWeatherJSON();
            }



            /* Application.EnableVisualStyles();
             * Application.SetCompatibleTextRenderingDefault(false);
             * stockView = new View.stockView();
             * edges = 0;
             * state = 0;
             * stockView.Visible = true;
             * stockView.startFadeinTimer();
             * Application.Run(stockView);
             *
             */

            InputPinConfiguration p = new InputPinConfiguration(ConnectorPin.P1Pin07.ToProcessor());
            GpioConnection        g = new GpioConnection(p);

            g.PinStatusChanged += g_detected;
        }
Пример #2
0
        public stockView()
        {
            //when implementing this, just call whatever the onCLick calls, hopefully we wont crash and fail :))))



            InitializeComponent();
            FormBorderStyle = FormBorderStyle.None;
            WindowState     = FormWindowState.Maximized;
            t          = new Timer();
            t.Interval = 10;
            t.Tick    += t_Tick;

            InputPinConfiguration p = new InputPinConfiguration(ConnectorPin.P1Pin07.ToProcessor());
            GpioConnection        g = new GpioConnection(p);

            g.PinStatusChanged += g_Detected;

            this.Opacity = 0;

            MMirrorManager mmc = MMirrorManager.instance;

            label42.Hide();
            List <Label> stockData = new List <Label>(40);
            var          c         = GetAll(this, typeof(Label));

            for (int i = 0; i < c.Count(); i++)
            {
                c.ElementAt(i).Text = "";
            }
            label42.Text = "No Internet Connection. Try again Later";

            label1.Text = mmc.getStock(0).stockName;
            label2.Text = mmc.getStock(1).stockName;
            label3.Text = mmc.getStock(2).stockName;
            label4.Text = mmc.getStock(3).stockName;
            //the ugly forward slashes below are because we were converting the settings from an html file and apparently couldnt remove all the tags

            if (mmc.getStock(4).stockName == "\"^FTSE\"")
            {
                label5.Text = "FTSE 100";
            }
            else if (mmc.getStock(4).stockName == "\"^FTMC\"")
            {
                label5.Text = "FTSE 250";
            }
            else if (mmc.getStock(4).stockName == "\"^N225\"")
            {
                label5.Text = "NIKKEI";
            }

            if (mmc.getStock(5).stockName == "\"BZZ15.NYM\"")
            {
                label6.Text = "Brent Crude Oil";
            }
            else if (mmc.getStock(5).stockName == "\"^GSPC\"")
            {
                label6.Text = "S" + '&' + "P 500";
            }
            else if (mmc.getStock(5).stockName == "\"WTI\"")
            {
                label6.Text = "WTI";
            }


            label9.Text  = mmc.getStock(0).closePrice + "";
            label10.Text = mmc.getStock(1).closePrice + "";
            label11.Text = mmc.getStock(2).closePrice + "";
            label12.Text = mmc.getStock(3).closePrice + "";
            label13.Text = mmc.getStock(4).closePrice + "";
            label14.Text = mmc.getStock(4).closePrice + "";


            label33.Text = mmc.getStock(0).volatility;
            label34.Text = mmc.getStock(1).volatility;
            label35.Text = mmc.getStock(2).volatility;
            label36.Text = mmc.getStock(3).volatility;
            label21.Text = mmc.getStock(4).volatility;
            label22.Text = mmc.getStock(5).volatility;

            startFadeinTimer();
            try
            {
                sc.getStockFile();
            }
            catch (Exception)
            {
            }
        }