コード例 #1
0
        private void UserControl_Initialized(object sender, EventArgs e)
        {
            viewmodel           = (viewmodel)XmlHelper.readFromXml(xmlfile, typeof(viewmodel));
            viewmodel.setFlow   = SetPowerFlow;
            grdMain.DataContext = viewmodel;
            grdMap.Children.Add(viewmodel.grid);
            viewmodel.map = earth;

            initdata();

            viewmodel.Initialize();


            //timer.Interval = TimeSpan.FromSeconds(2);
            //timer.Tick += new EventHandler(timer_Tick);
            //timer.Start();
        }
コード例 #2
0
        private void btnRebuild_Click(object sender, RoutedEventArgs e)
        {
            viewmodel.SaveToXml(xmlfile);

            //timer.Stop();
            viewmodel.grid.Children.Clear();
            grdMap.Children.Remove(viewmodel.grid);

            viewmodel           = (viewmodel)XmlHelper.readFromXml(xmlfile, typeof(viewmodel));
            viewmodel.setFlow   = SetPowerFlow;
            grdMain.DataContext = viewmodel;
            grdMap.Children.Add(viewmodel.grid);
            viewmodel.map = earth;

            initdata();

            viewmodel.Initialize();

            //timer.Start();
        }