Example #1
0
        public ToolbarPositionSettings(IToolbarService toolbarService)
        {
            VEFModule.EventAggregator.GetEvent <WindowClosingEvent>().Subscribe(SaveToolbarPositions);
            _toolTray = toolbarService as AbstractToolbar;
            _loadDict = new Dictionary <string, ToolbarSettingItem>();

            if (this.Toolbars != null && this.Toolbars.Count > 0)
            {
                foreach (var setting in this.Toolbars)
                {
                    _loadDict[setting.Header] = setting;
                }

                for (int i = 0; i < _toolTray.Children.Count; i++)
                {
                    AbstractToolbar tb = _toolTray.Children[i] as AbstractToolbar;
                    if (_loadDict.ContainsKey(tb.Header))
                    {
                        ToolbarSettingItem item = _loadDict[tb.Header];
                        tb.Band      = item.Band;
                        tb.BandIndex = item.BandIndex;
                        tb.IsChecked = item.IsChecked;
                        tb.Refresh();
                    }
                }
            }
        }
Example #2
0
        public ToolbarPositionSettings(IContainerExtension container)
        {
            container.Resolve <IEventAggregator>().GetEvent <WindowClosingEvent>().Subscribe(SaveToolbarPositions);
            _toolTray = container.Resolve <IToolbarService>() as AbstractToolbar;
            _loadDict = new Dictionary <String, ToolbarSettingItem>();

            if (Toolbars != null && Toolbars.Count > 0)
            {
                foreach (ToolbarSettingItem setting in Toolbars)
                {
                    _loadDict[setting.Header] = setting;
                }

                for (Int32 i = 0; i < _toolTray.Children.Count; i++)
                {
                    AbstractToolbar tb = _toolTray.Children[i] as AbstractToolbar;
                    if (_loadDict.ContainsKey(tb.Header))
                    {
                        ToolbarSettingItem item = _loadDict[tb.Header];
                        tb.Band      = item.Band;
                        tb.BandIndex = item.BandIndex;
                        tb.IsChecked = item.IsChecked;
                        tb.Refresh();
                    }
                }
            }
        }
Example #3
0
 /// <summary>
 /// Adds the specified item.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns><c>true</c> if successfully added, <c>false</c> otherwise</returns>
 public String Add(AbstractToolbar item)
 {
     if (item is AbstractToolbar tb)
     {
         tb.IsCheckable = true;
         tb.IsChecked   = true;
     }
     return(base.Add(item));
 }
Example #4
0
 private void SaveToolbarPositions(Window window)
 {
     this.Toolbars = new List <ToolbarSettingItem>();
     for (int i = 0; i < _toolTray.Children.Count; i++)
     {
         AbstractToolbar tb = _toolTray.Children[i] as AbstractToolbar;
         Toolbars.Add(new ToolbarSettingItem(tb));
     }
     Save();
 }
Example #5
0
        /// <summary>
        /// Adds the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns><c>true</c> if successfully added, <c>false</c> otherwise</returns>
        public override string Add(AbstractCommandable item)
        {
            AbstractToolbar tb = item as AbstractToolbar;

            if (tb != null)
            {
                tb.IsCheckable = true;
                tb.IsChecked   = true;
            }
            return(base.Add(item));
        }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AbstractWorkspace" /> class.
 /// </summary>
 /// <param name="container">The injected container.</param>
 /// <param name="eventAggregator">The event aggregator.</param>
 protected AbstractWorkspace(IUnityContainer container, IEventAggregator eventAggregator)
 {
     _container               = container;
     _eventAggregator         = eventAggregator;
     _docs                    = new ObservableCollection <ContentViewModel>();
     _docs.CollectionChanged += Docs_CollectionChanged;
     _tools                   = new ObservableCollection <ToolViewModel>();
     _menus                   = _container.Resolve <IMenuService>() as MenuItemViewModel;
     _menus.PropertyChanged  += _menus_PropertyChanged;
     _toolbarService          = _container.Resolve <IToolbarService>() as AbstractToolbar;
     _statusbarService        = _container.Resolve <IStatusbarService>();
     _commandManager          = _container.Resolve <ICommandManager>();
 }
Example #7
0
        /// <summary>
        /// Adds the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns><c>true</c> if successfully added, <c>false</c> otherwise</returns>
        public override string Add(AbstractCommandable item)
        {
            AbstractToolbar tb = item as AbstractToolbar;

            if (tb != null)
            {
                tb.IsCheckable = true;
                //  tb.IsChecked = true; default = unchecked
            }

            string res = base.Add(item);

            return(res);
        }
Example #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AbstractWorkspace" /> class.
        /// </summary>
        /// <param name="container">The injected container.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        protected AbstractWorkspace(IUnityContainer container, IEventAggregator eventAggregator)
        {
            _container               = container;
            _eventAggregator         = eventAggregator;
            _docs                    = new ObservableCollection <ContentViewModel>();
            _docs.CollectionChanged += Docs_CollectionChanged;
            _tools                   = new ObservableCollection <ToolViewModel>();
            _menus                   = _container.Resolve <IMenuService>() as MenuItemViewModel;
            _menus.PropertyChanged  += _menus_PropertyChanged;
            _toolbarService          = _container.Resolve <IToolbarService>() as AbstractToolbar;
            _statusbarService        = _container.Resolve <IStatusbarService>();
            _commandManager          = _container.Resolve <ICommandManager>();

            //    this.ConfirmationRequest = new InteractionRequest<Confirmation>();
            //     this.NotificationRequest = new InteractionRequest<Notification>();

            MinHeight = 200; //default
            MinHeight = 200; //default
        }
Example #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AbstractWorkspace" /> class.
        /// </summary>
        /// <param name="container">The injected container.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        protected AbstractWorkspace()
        {
            _docs = new ObservableCollection <ContentViewModel>();
            _docs.CollectionChanged += Docs_CollectionChanged;
            _tools = new ObservableCollection <ToolViewModel>();
            _menus = VEFModule.UnityContainer.Resolve(typeof(IMenuService), "") as MenuItemViewModel;
            //     _menus = VEFModule.UnityContainer.Resolve(typeof(MenuItemViewModel), "MenuItemViewModel") as MenuItemViewModel;
            _menus.PropertyChanged += _menus_PropertyChanged;
            _toolbarService         = VEFModule.UnityContainer.Resolve(typeof(IToolbarService), "") as AbstractToolbar;
            //    _toolbarService = VEFModule.UnityContainer.Resolve(typeof(AbstractToolbar), "AbstractToolbar") as AbstractToolbar;
            _statusbarService = VEFModule.UnityContainer.Resolve(typeof(IStatusbarService), "") as IStatusbarService;
            _commandManager   = VEFModule.UnityContainer.Resolve(typeof(ICommandManager), "") as ICommandManager;

            //    this.ConfirmationRequest = new InteractionRequest<Confirmation>();
            //     this.NotificationRequest = new InteractionRequest<Notification>();

            MinHeight = 200; //default
            MinHeight = 200; //default
        }