示例#1
0
 private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (this.DataContext != null)
     {
         _model = this.DataContext as MSOTSystem;
     }
     else
     {
         _model = null;
     }
 }
示例#2
0
        /// <summary>
        /// Start System and load all basic modules.
        /// </summary>
        public void StartMSOT(WindowContainer tempWindowContainer)
        {
            try
            {
                ChildWindowContainer = tempWindowContainer;

                _paintCursor        = ViewSystemHelper.LoadCursorResource("pack://application:,,,/ViewMSOT.UIControls;component/GFX/Paint.cur");
                _system             = new MSOTSystem();
                _system.PaintCursor = _paintCursor;
                _system.Notify     += systemPushNotifications;
                _system.Verify     += system_Verify;

                _system.InitializePlugin("MSOT System", null);
                if (_system.HasSystemConfigWriteAccess)
                {
                    _system.ExtractAll("");
                }
                _system.CommandLoad.Execute(null);

                _system.AddEmptyImagingSessionAtAnalysis              = true;
                _system.EnablePreviewVisibleImagesRepeatMode          = true;
                _system.AddSnapshotImagingSuperSessionAtVisualization = true;

                _log = _system.IMSOTLog;

                string cfgFile = "";
                if (_system.IsUsingAdvancedGui)
                {
                    cfgFile = " - " + System.IO.Path.GetFileNameWithoutExtension(_system.SettingsFilePath);
                }
                this.Title = _system.MsotApplicationInfo.ProductName;
                this.TaskbarItemInfo.Description = this.Title + cfgFile;
                this.DataContext = _system;

                if (_system.IsSystemSuccessfullyLoaded())
                {
                    _pendingPushedMessagesHandled = true;
                    loadSystemOnStartUp();
                }

                ChildWindowContainer = childWindowContainer;
            }
            catch (Exception ex)
            {
                NotifyUserOnError("Unable to load " + this.Title + "\nException: " + ex.Message, Title, UserNotificationType.Error, false);
                //System.Windows.MessageBox.Show(this,"Unable to load "+this.Title + "\nException: "+ex.Message);
            }
            finally
            {
                _system.SystemExit += OnSystemExited;
                _system.Notify     -= systemPushNotifications;
                _system.Notify     += system_Notify;
            }
        }