コード例 #1
0
        static void Main()
        {
            Application.ThreadException += new ThreadExceptionEventHandler(HandleUIException);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //NeuralAgentTrainer.TrainAndSimulate(1, new int[] { 18, 9, 1 }, "Empty_Small.png");
            //NeuralAgentTrainer.TrainAndSimulate(4, new int[] { 84, 84, 42, 21, 7, 1 }, "Bottleneck_Small_1.png");
            //NeuralAgentTrainer.TrainAndSimulate(4, new int[] { 84, 84, 42, 21, 7, 1 }, "Example1.png");

            //var obstacles = new bool[,] {
            //    { true, false, false, false, true },
            //    { false, false, false, false, false },
            //    { false, false, true, false, false },
            //    { false, true, false, true, false },
            //    { true, false, false, false, true },
            //};
            //Form form2 = new Form();
            //AnimatedLayersControl grid = new AnimatedLayersControl();
            //grid.Dock = DockStyle.Fill;
            //BitmapLayer layer1 = new BitmapLayer(grid, obstacles);
            //AnimatedLayer layer2 = new AnimatedLayer(grid, obstacles.GetLength(0), obstacles.GetLength(1));
            //layer2.Objects.Add(new AnimatedRectangle(0, 0, 4, 4, 30));
            //layer2.Objects.Add(new AnimatedRectangle(2, 2, 0, 3, 20));
            ////grid.Layers.Add(layer1);
            ////grid.Layers.Add(layer2);
            //form2.Controls.Add(grid);
            //form2.Load += (sender, e) => grid.AnimationTimer.Start();
            //Application.Run(form2);
            //return;

            var workspace = Workspace.Instance;
            var form      = new LabForm();

            form.Workspace = workspace;
            var extension1 = new NeuralLabFormExtension(form, workspace);
            var extension2 = new DijkstraLabFormExtension(form, workspace);
            var extension3 = new AStarLabFormExtension(form, workspace);

            Application.Run(form);
        }
コード例 #2
0
        public void LoadSyncFile(XElement doc)
        {
            SyncFile = doc;

            SourceDatabase = String.Empty;

            if (doc.Attribute("SourceDbType") != null)
            {
                SourceDatabase = doc.Attribute("SourceDbType").Value;
            }
            if (doc.Attribute("CreatedDate") != null)
            {
                DateGenerated = doc.Attribute("CreatedDate").Value;
            }
            if (doc.Attribute("CreatedUtc") != null)
            {
                DateGeneratedUtc = doc.Attribute("CreatedUtc").Value;
            }
            if (doc.Attribute("Version") != null)
            {
                EpiVersion = doc.Attribute("Version").Value;
            }
            if (doc.Attribute("VhfVersion") != null)
            {
                VhfVersion = doc.Attribute("VhfVersion").Value;
            }
            if (doc.Attribute("Id") != null)
            {
                FileID = doc.Attribute("Id").Value;
            }
            if (doc.Attribute("Region") != null)
            {
                Region = doc.Attribute("Region").Value;
            }

            if (doc.Attribute("StartDate") != null)
            {
                StartDate = doc.Attribute("StartDate").Value;
            }
            if (doc.Attribute("EndDate") != null)
            {
                EndDate = doc.Attribute("EndDate").Value;
            }

            foreach (XElement element in doc.Elements("Form"))
            {
                if (element.Attribute("Name").Value.Equals("CaseInformationForm", StringComparison.OrdinalIgnoreCase))
                {
                    CaseForm = element;

                    // because sync files created from MDB-based projects have <record>s broken up by page it's necessary to rebuild them here

                    if (SyncFile.Attribute("SourceDbType") != null && SyncFile.Attribute("SourceDbType").Value.Equals("Access"))
                    {
                        CaseData = RebuildCaseRecords();
                    }
                    else
                    {
                        CaseData = CaseForm.Element("Data");
                    }
                }
                else if (element.Attribute("Name").Value.Equals("ContactEntryForm", StringComparison.OrdinalIgnoreCase))
                {
                    ContactForm = element;
                    ContactData = ContactForm.Element("Data");
                }
                else if (element.Attribute("Name").Value.Equals("LaboratoryResultsForm", StringComparison.OrdinalIgnoreCase))
                {
                    LabForm = element;
                    LabData = LabForm.Element("Data");
                }
            }

            LinksData = doc.Element("Links");

            FollowUpsData = doc.Element("ContactFollowUps");

            AnalysisViewModel = new AnalysisViewModel(SyncFile);
        }