Ejemplo n.º 1
0
 public DeviceVM(Device dev, DeviceBatchContext context) : base(context)
 {
     TheDevice = dev;
     PopulateTestConditions();
     PopulatePixelsDict();
     GenerateDataVMsFromChildren();
 }
Ejemplo n.º 2
0
        private async Task <MainWindowViewModel> InitializeAsync()
        {
            return(await Task.Run(async() =>
            {
                Trace.AutoFlush = true;

                var sysname = System.Environment.MachineName;
                if (sysname == "JAKE-PC")
                {
                    ConfigurationManager.AppSettings.Set("BatchTestSystem", "BTS1");
                }
                else if (sysname == "DESKTOP-GQQ0M3J")
                {
                    ConfigurationManager.AppSettings.Set("BatchTestSystem", "BTS2");
                }
                Debug.WriteLine("sysname: " + sysname);
                await InstrumentService.CreateCoordinatorAsync();
                await OriginService.CreateControllerAsync();
                await DataProcessingService.CreateLEDCalculatorAsync();
                if (Debugger.IsAttached)
                {
                    Properties.Settings.Default.Reset();
                }
                var dBConnectionManager = new DBConnectionManager();
                ctx = new DeviceBatchContext();
                Task[] initTasks = new Task[2];
                initTasks[0] = LoadDirectoryTreeView();
                initTasks[1] = UpdateIPAddress();
                await Task.WhenAll(initTasks);
                Trace.TraceInformation("Initialized MainWindowViewModel");
                return this;
            }).ConfigureAwait(false));
        }
Ejemplo n.º 3
0
        void CheckForDBConnection()
        {
            try
            {
                //check to see if connectionstring will open connection with db
                var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                var connectionStringsSection = (ConnectionStringsSection)config.GetSection("connectionStrings");
                var connstring = connectionStringsSection.ConnectionStrings["ServerConnectionString"].ConnectionString;
                Debug.WriteLine("connectionString from configmanager is: " + connstring);

                bool dumbBool = false;
                //var efconfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None,);
                using (ctx = new DeviceBatchContext(connstring))
                {
                    Debug.WriteLine("ctx.Database.Connection.ConnectionString: " + ctx.Database.Connection.ConnectionString);
                    if (ctx.Database.Exists())
                    {
                        Debug.WriteLine("ctx.Database.Exists()==true");
                        var firstDevBatch = ctx.DeviceBatches.First();
                        Debug.WriteLine("Successfully opened DB connection. First DevBatch.Name is " + firstDevBatch.Name);
                    }
                    else
                    {
                        Debug.WriteLine("ctx.Database.Exists()==false");
                        ctx.Dispose();
                        dumbBool = true;
                        //PromptForDBCredentials();
                    }
                }
                if (dumbBool)
                {
                    PromptForDBCredentials();
                    CheckForDBConnection();
                }
                //ctx.Database.Connection.ConnectionString = connstring;
                //ctx.Database.Connection.Open();
            }
            catch (SqlException e)
            {
                Debug.WriteLine("SqlException: " + e.ToString());
                //ctx.Dispose();
                //System.Windows.MessageBox.Show(e.ToString());
                //ctx.Database.Connection.Close();
                PromptForDBCredentials();
                CheckForDBConnection();
            }
            catch (Exception e)
            {
                Debug.WriteLine("Exception: " + e.ToString());
                //ctx.Dispose();
                PromptForDBCredentials();
                CheckForDBConnection();
            }
        }
Ejemplo n.º 4
0
 private async Task <SingleDeviceScanVM> InitializeAsync(Device dev, DeviceBatchContext context)
 {
     return(await Task.Run(() =>
     {
         TheDeviceVM = new DeviceVM(dev, ctx);
         RunVoltageSweepCommand = AsyncCommand.Create(token => ScanPixelAndProcessData(token));
         TheLJVScanSummaryVM = new LJVScanSummaryVM(ctx);
         TheLJVScanSummaryVM.TheLJVScanSummary.Device = ctx.Devices.Where(x => x.DeviceId == TheDeviceVM.TheDevice.DeviceId).First();
         TheLJVScanSummaryVM.TheLJVScanSummary.TestCondition = TheScanSpec.TestCondition;
         string bts = ConfigurationManager.AppSettings.Get("BatchTestSystem");
         if (bts == "BTS2")
         {
             TheImagingControl = InstrumentService.LJVScanCoordinator.TheImagingControl;
         }
         return this;
     }));
 }
Ejemplo n.º 5
0
        public static Task <SingleDeviceScanVM> CreateAsync(Device dev, DeviceBatchContext context)
        {
            var ret = new SingleDeviceScanVM();

            return(ret.InitializeAsync(dev, context));
        }
Ejemplo n.º 6
0
 public CrudVMBase(DeviceBatchContext context)
 {
     System.Diagnostics.Debug.WriteLine("CrudVMBase instantiated");
     ctx = context;
 }
Ejemplo n.º 7
0
 protected CrudVMBase(string connString = "ServerConnectionString")
 {
     ctx = new DeviceBatchContext();
     ctx.Database.Connection.ConnectionString = ConfigurationManager.ConnectionStrings[connString].ConnectionString;
 }
 public LJVScanSummaryVM(DeviceBatchContext context) : base(context)
 {
     System.Diagnostics.Debug.WriteLine("LJVScanSummaryVM instantiated");
     TheLJVScanSummary = new DeviceLJVScanSummary();
 }