Пример #1
0
        private async void BeginInitialize()
        {
            // Setup the database.
            db = new DatabaseHelper(this);
            // Use the intent values to bind to a specific network ID.
            long networkID = Intent.GetLongExtra(EXTRA_NETWORK_ID, -1);

            if (networkID != -1)
            {
                solarNetwork = await db.SolarNetworks.SelectByIdAsync(networkID);

                SupportActionBar.Title = solarNetwork.Name;
            }
            else
            {
                throw new InvalidProgramException();
            }

            // Get the weather service.
            weatherProvider = ServiceManager.Resolve <IWeatherProvider>();
            // Get the calculator service.
            powerCalculator = ServiceManager.Resolve <IPowerCalculator>();
            // Initialize the PVWatts Client.
            pvWattsApiClient = new PVWattsV5ApiClient(apiKey: Secrets.PVWattsApiKey);

            // Setup the network card
            InitializeCards();
        }
Пример #2
0
        private async void SetObjects(int ID1, int ID2)
        {
            db = new DatabaseHelper(this);
            sn = await db.SolarNetworks.SelectByIdAsync(ID1);

            panel = await db.Panels.SelectByIdAsync(ID2);

            SupportActionBar.Title = sn.Name + " - Panels - Info";
            UpdateTiltAngle();
            UpdateSummaryAsync();
            var PanelCount = FindViewById <TextView>(Resource.Id.panelCount);

            PanelCount.Text = panel.Count.ToString();
            var ppr = FindViewById <TextView>(Resource.Id.ppr);

            ppr.Text = panel.PowerRating.ToString() + " kW/h";
            var tpr = FindViewById <TextView>(Resource.Id.tpr);

            tpr.Text = (panel.PowerRating * panel.Count).ToString() + " kW/h";
            var pmt = FindViewById <TextView>(Resource.Id.pmt);

            pmt.Text = Resources.GetStringArray(Resource.Array.module_type_array)[(int)panel.ModuleType];
            var cardview = FindViewById <CardView>(Resource.Id.itemCardView);
            var pat      = FindViewById <TextView>(Resource.Id.pat);

            pat.Text = Resources.GetStringArray(Resource.Array.array_type_array)[(int)panel.ArrayType];
            var systemLosses = FindViewById <TextView>(Resource.Id.systemLosses);

            systemLosses.Text = panel.SystemLosses.ToString() + "%";
        }
Пример #3
0
 public Network(SolarNetwork sn)
 {
     ID              = sn.ID;
     Name            = sn.Name;
     Panels          = 0;
     PanelsEnergy    = 0;
     Consumers       = 0;
     ConsumersEnergy = 0;
 }
Пример #4
0
        public async Task AddNetwork(string name, GeoCoords coords)
        {
            Network      net = new Network(name);
            SolarNetwork sn  = new SolarNetwork();

            sn.Name       = net.Name;
            sn.Longtitude = coords.Longitude;
            sn.Latitude   = coords.Latitude;
            net.ID        = (int)await db.SolarNetworks.InsertAsync(sn);

            netList.Add(net);
            UpdateAdapter();
        }
Пример #5
0
        private async void LoadPanels()
        {
            solarNetwork = await db.SolarNetworks.SelectByIdAsync(netID);

            var pl = (await db.Panels.SelectAllAsync()).ToList();

            foreach (var p in pl)
            {
                if (p.NetworkID == netID)
                {
                    PanelListItem pli = new PanelListItem(p);
                    panelList.Add(pli);
                }
            }
            UpdateAdapter();
        }
Пример #6
0
        private async void GetObject(int ID)
        {
            sn = await db.SolarNetworks.SelectByIdAsync(ID);

            SupportActionBar.Title = sn.Name + " - Consumers";
        }