コード例 #1
0
 public MainViewModel()
 {
     try
     {
         if (!gDB.DataBaseExist)
         {
             if (!gDB.DataBaseCreate())
             {
                 throw new Exception("Data Base cannot create!");
             }
         }
     }
     catch (Exception ex)
     {
         Message.Error(ex.Message);
     }
     sqlDBc = new SQLiteContext();
     ThisMachineIsRegistred = sqlDBc.Machines.Any(m => m.machineName == Global.ThisMachineName && m.userName == Global.ThisUserName);
     if (ThisMachineIsRegistred)
     {
         LocalMachine = sqlDBc.Machines.First(m => m.machineName == Global.ThisMachineName && m.userName == Global.ThisUserName);
     }
     else
     {
         LocalMachine = new Machine {
             machineName = Global.ThisMachineName, userName = Global.ThisUserName
         };
     }
     ThisMachineName   = Global.ThisMachineName;
     ThisUserName      = Global.ThisUserName;
     AllGamesTableView = new AllGamesTableView();
     LocalGamesView    = new LocalGamesView();
     AllMachinesTable  = new MachinesTableView();
     DbEditView        = new DBeditView();
     SettingsView      = new SettingsView();
     CurrentPage       = LocalGamesView;
     PageTitle         = "Local Games";
 }