Exemplo n.º 1
0
        private void DoSaveRecord(object obj)
        {
            ObservableCollection <string> causes = new ObservableCollection <string>();

            for (int i = 0; i < availablePresentationObjects.Count(); i++)
            {
                if (availablePresentationObjects[i].IsChecked == true)
                {
                    availablePresentationObjects[i].IsChecked = false;
                    Debug.WriteLine(availablePresentationObjects[i].Name);
                    causes.Add(availablePresentationObjects[i].Name);
                }
            }

            FloodRecord record = new FloodRecord();

            record.Latitude   = currentLatitude;
            record.Longitude  = currentLongitude;
            record.Time       = currentTimeStamp;
            record.WaterLevel = _waterLevel.ToString();
            record.causes     = causes;
            if (_waterLevel.ToString() != "" && causes.Count() != 0)
            {
                _waterLevel = 230 / 2;
                RaisePropertyChanged("waterLevel");
            }
            othersIsChecked = false;
            others          = "";
            RaisePropertyChanged("AvailablePresentationObjects");
            RaisePropertyChanged("others");
            RaisePropertyChanged("othersIsChecked");
            MenuViewBase recordView = HomeScreenViewModel.GetInstance().ShowRecordView();

            recordView.RaiseUserInputReadyEvent(new SaveButtonClickedEventArgs(record));
        }
Exemplo n.º 2
0
        private void DoSaveRecord(object obj)
        {
            ObservableCollection <string> causes = new ObservableCollection <string>();

            for (int i = 0; i < availablePresentationObjects.Count(); i++)
            {
                if (availablePresentationObjects[i].IsChecked == true)
                {
                    availablePresentationObjects[i].IsChecked = false;
                    Debug.WriteLine(availablePresentationObjects[i].Name);
                    causes.Add(availablePresentationObjects[i].Name);
                }
            }

            //FloodRecord record = new FloodRecord();
            //record.Latitude = currentLatitude;
            //record.Longitude = currentLongitude;
            //record.Time = currentTimeStamp;
            //record.WaterLevel = _waterLevel.ToString();
            //record.causes = causes;
            if (_waterLevel.ToString() != "" && causes.Count() != 0)
            {
                _waterLevel = 230 / 2;
                RaisePropertyChanged("waterLevel");
            }
            othersIsChecked = false;
            others          = "";
            RaisePropertyChanged("AvailablePresentationObjects");
            RaisePropertyChanged("others");
            RaisePropertyChanged("othersIsChecked");
            MenuViewBase recordView = HomeScreenViewModel.GetInstance().ShowRecordView();
            //recordView.RaiseUserInputReadyEvent(new SaveButtonClickedEventArgs(record));

            // Initialize the record object
            dynamic record = DllFileLoader.CreateAnInstance();

            record.waterLevel = waterLevel;
            record.PossibleCauseOfDisaster = causes;
            record.currentLongitude        = currentLongitude;
            record.currentLatitude         = currentLatitude;
            record.currentTimeStamp        = currentTimeStamp;
            // Signal Core for record
            recordView.OnSavingFloodRecord(record);
        }
Exemplo n.º 3
0
        private void DoSaveRecord(object obj)
        {
            LandslideRecord record = new LandslideRecord();

            record.Time       = currentDateTime.ToString();
            record.Latitude   = currentLatitude.ToString();
            record.Longitude  = currentLongitude.ToString();
            record.deathToll  = deathToll.ToString();
            record.injuryToll = injuryToll.ToString();
            record.conditions = new ObservableCollection <string>()
            {
                null, null, null, null, null
            };
            photoUploaded = null;
            Layer         = new Microsoft.Maps.MapControl.WPF.MapLayer();
            foreach (var e in checkedLandslideCondition.ToList())
            {
                if (e.Contains("House"))
                {
                    record.conditions[0] = e;
                }
                else if (e.Contains("Farm"))
                {
                    record.conditions[1] = e;
                }
                else if (e.Contains("Road"))
                {
                    record.conditions[2] = e;
                }
                else if (e.Contains("River"))
                {
                    record.conditions[3] = e;
                }
                else
                {
                    record.conditions[4] = e;
                }
                checkedLandslideCondition.Remove(e);
            }
            deathToll      = -1;
            injuryToll     = -1;
            houseDamage    = false;
            houseSelected  = null;
            riverDamage    = false;
            riverSelected  = null;
            farmDamage     = false;
            farmSelected   = null;
            groundDamage   = false;
            groundSelected = null;
            roadDamage     = false;
            roadSelected   = null;
            RaisePropertyChanged("deathToll");
            RaisePropertyChanged("injuryToll");
            RaisePropertyChanged("photoUploaded");
            RaisePropertyChanged("saveRecord");
            RaisePropertyChanged("checkedLandslideCondition");
            RaisePropertyChanged("houseDamage");
            RaisePropertyChanged("riverDamage");
            RaisePropertyChanged("farmDamage");
            RaisePropertyChanged("roadDamage");
            RaisePropertyChanged("groundDamage");
            RaisePropertyChanged("houseSelected");
            RaisePropertyChanged("riverSelected");
            RaisePropertyChanged("farmSelected");
            RaisePropertyChanged("roadSelected");
            RaisePropertyChanged("groundSelected");
            MenuViewBase recordView = HomeScreenViewModel.GetInstance().ShowOtherView();

            recordView.RaiseUserInputReadyEvent(new SaveButtonClickedEventArgs(record));
        }
Exemplo n.º 4
0
 private void ChangeMenuView(MenuViewBase control)
 {
     currentMenuView = control;
     RaisePropertyChanged("CurrentMenuView");
 }
Exemplo n.º 5
0
 private void ChangeMenuView(MenuViewBase control)
 {
     _CurrentMenuView = control;
     OnPropertyChanged("CurrentMenuView");
 }