示例#1
0
        public MainWindow()
        {
            //Global Exception Handling
            var currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += GlobalExceptionHandler;

            InitializeComponent();

            // Window Title
            var    currentAssembly = Assembly.GetExecutingAssembly();
            string versionNumber   = currentAssembly.GetName().Version.ToString();

            Title = Title + " (" + versionNumber + ")";

            _context        = (WorkerContext)DataContext;
            _context.Status = "Starting up...";
            //Enable the cross acces to this collection elsewhere
            //BindingOperations.EnableCollectionSynchronization(_context.Object, _synLock);

            // Start Processes
            _running = true;
            var t1 = new Thread(AutoProcessing);

            t1.Start();

            _context.Status = "Started.";
        }
示例#2
0
        private void AutoProcessing()
        {
            while (_running)
            {
                lock (_synLock)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Render,
                                           (SendOrPostCallback) delegate
                    {
                        _context = (WorkerContext)DataContext;

                        // Do Stuff
                    }, null);


                    Monitor.Wait(_synLock, 100);
                }
            }
        }