예제 #1
0
 public SessionViewModel()
 {
     Log = new ObservableCollection<LogMessage>();
     PiInfo = new RaspberryPiInfo() { IpAddress = "192.168.1.2", Port = "5000" };
    // ImageSource = new BitmapImage();
     ImgHelper = new ImageHelper();
     DbHelper = new DatabaseHelper(DatabaseHelper._SQLitePlatformWinRT, DatabaseHelper.DB_PATH);
     try
     {
         ObservableCollection<RaspberryPiInfo> pis = DbHelper.ReadAllGeneric<RaspberryPiInfo>();
         PiInfo = pis.First(x => x.isDefault);
     }
     catch
     {
         Log.Add(new LogMessage("No Default Pi is in the database please add one"));
     }
     
   // Image     ImageHelper.ReadImageFromPi
 }
        private async Task SetDefault(RaspberryPiInfo info)
        {
           RaspberryPiInfo currentDefault = PiCatalog.First(x => x.isDefault == true);
            info.isDefault = true;
            currentDefault.isDefault = false;

            dbHelper.UpdateRaspberryPiInfo(info);
            dbHelper.UpdateRaspberryPiInfo(currentDefault);
            DefaultPi = info;

        }