コード例 #1
0
ファイル: LinePlanModule.cs プロジェクト: wcrooy/cwpfsamples
        public void Initialize()
        {
            container.RegisterType<ILinePlanService, LinePlanService>(
                // This will register the type as a singleton instance.
                new ContainerControlledLifetimeManager());

            LinePlanExplorerModel model = new LinePlanExplorerModel(container);
            explorerController.OpenDocument(model);
        }
コード例 #2
0
        private void DispatchHelper(LinePlanExplorerModel model)
        {
            DispatcherFrame frame = new DispatcherFrame();

            PropertyChangedEventHandler waitForModelHandler = new PropertyChangedEventHandler(
                delegate(object sender, PropertyChangedEventArgs e) {
                    if (e.PropertyName == "State" && model.State != ModelState.Fectching) {
                        frame.Continue = false;
                    }
                });

            model.PropertyChanged += waitForModelHandler;

            DispatcherTimer tmr = new DispatcherTimer();
            tmr.Interval = new TimeSpan(0, 0, 10);
            tmr.Tag = frame;
            tmr.Start();
            tmr.Tick += new EventHandler(DoDispatcherHelperTimeout);
            Dispatcher.PushFrame(frame);

            if (tmr.Tag == null) {
                throw new TimeoutException("Timeout waiting for state change.");
            }
        }
コード例 #3
0
        /// <summary>
        /// Creates a new instance of <c>LinePlanExplorer</c>.
        /// </summary>
        /// <remarks>
        /// Almost everything needs to be moved back to the model, just need to
        /// figure out how to go about doing that.
        /// </remarks>
        public LinePlanExplorer(LinePlanExplorerModel model)
        {
            InitializeComponent();

            Model = model;
        }