Beispiel #1
0
        public App()
        {
            InitializeComponent();
            // Load saved data from JSON file
            string DataBaseFileName = "savedata.JSON";
            string DataBasePath     = Path.Combine(Environment.CurrentDirectory, @"database", DataBaseFileName);
            String JSONstring       = File.ReadAllText(DataBasePath);

            savedata = JsonConvert.DeserializeObject <List <ReportInterface.DimensionLine> >(JSONstring);
            // If JSON is empty we have null
            if (savedata == null)
            {
                savedata = new List <ReportInterface.DimensionLine>();
            }

            // Load test data from JSON file
            string TestDataBaseFileName = "testdata.JSON";
            string TestDataBasePath     = Path.Combine(Environment.CurrentDirectory, @"database", TestDataBaseFileName);
            String TestJSONstring       = File.ReadAllText(TestDataBasePath);

            testdata = JsonConvert.DeserializeObject <List <ReportInterface.TestData> >(TestJSONstring);
            // If JSON is empty we have null
            if (testdata == null)
            {
                testdata = new List <ReportInterface.TestData>();
            }

            System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.High;
            //MainReportInterface = ((ReportInterface)Application.Current.FindResource("MainReport"));

            PLC         = ((PLCInterface)Application.Current.FindResource("PLCinterf"));
            HDevExp     = new HDevelopExport();
            pIzvjestaji = new PIzvjestaji();
            pPostavke   = new PPostavke();
            pRobot      = new PRobot();
            pPoroznost  = new PPoroznost();
            pUcenje     = new PUcenje();
            pVisine     = new PVisine();
            pDijametri  = new PDijametri();
            pRucno      = new PRucno();
            //Report interface
            //initReportInterface = new ReportInterface();
            PLC.StartCyclic(); // Possible system null reference
            PLC.Update_Online_Flag += new PLCInterface.OnlineMarker(PLCInterface_PLCOnlineChanged);
            PLC.Update_100_ms      += new PLCInterface.UpdateHandler(PLC_Update_100_ms);
            //PLC.Update_1_s += new PLCInterface.UpdateHandler(PLC_Update_1_s);
            HDevExp.UpdateResult              += new HDevelopExport.UpdateHandler(HalconUpdate);
            HDevExp.UpdateResultPick          += new HDevelopExport.UpdateHandlerPick(PickUpdate);
            HDevExp.PorosityDetected          += new HDevelopExport.PorosityDetectedEventHandler(PorosityIsDetected);
            HDevExp.PorosityDetectionStart    += new HDevelopExport.PorosityDetectionStartEventHandler(DetectionStart);
            HDevExp.PorosityDetectionHorStart += new HDevelopExport.PorosityDetectionHorStartEventHandler(DetectionHorStart);
            // Frame always ON CAM4
            //HDevExp.OpenCamFrame();
        }
Beispiel #2
0
        public App()
        {
            System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.High;
            InitializeComponent();
            MainReportInterface = ((ReportInterface)Application.Current.FindResource("MainReport"));

            PLC         = ((PLCInterface)Application.Current.FindResource("PLCinterf"));
            pIzvjestaji = new PIzvjestaji();
            pPostavke   = new PPostavke();
            pDimenzije  = new PDimenzije();
            pSrh        = new PSrh();
            pValovitost = new PValovitost();
            pSablja     = new PSablja();
            pKut        = new PKut();
            pRucno      = new PRucno();
            pRucno      = new PRucno();

            App.PLC.StartCyclic();
            App.PLC.Update_Online_Flag += new PLCInterface.OnlineMarker(PLCInterface_PLCOnlineChanged);
            App.PLC.Update_100_ms      += new PLCInterface.UpdateHandler(PLC_Update_100_ms);
            App.HDevExp.UpdateResult   += new HDevelopExport.UpdateHandler(HalconUpdate);
        }