Пример #1
0
        public void Load()
        {
            this.UiTypes.Clear();

            Type[] types = DllHelper.GetMonoTypes();

            foreach (Type type in types)
            {
                object[] attrs = type.GetCustomAttributes(typeof(UIFactoryAttribute), false);
                if (attrs.Length == 0)
                {
                    continue;
                }

                UIFactoryAttribute attribute = attrs[0] as UIFactoryAttribute;
                if (UiTypes.ContainsKey((UIType)attribute.Type))
                {
                    Log.Debug($"已经存在同类UI Factory: {attribute.Type}");
                    throw new Exception($"已经存在同类UI Factory: {attribute.Type}");
                }
                object     o       = Activator.CreateInstance(type);
                IUIFactory factory = o as IUIFactory;
                if (factory == null)
                {
                    Log.Error($"{o.GetType().FullName} 没有继承 IUIFactory");
                    continue;
                }
                this.UiTypes.Add((UIType)attribute.Type, factory);
            }
        }
Пример #2
0
        /// <summary>
        /// Adds a factory
        /// </summary>
        /// <param name="factory">The factory to add</param>
        public void Add(IUIFactory factory)
        {
            List <IUIFactory> l = new List <IUIFactory>(factories);

            l.Add(factory);
            factories = l.ToArray();
        }
Пример #3
0
        protected void AddGenericFactory(Application app, Window window, Grid grid, IUIFactory <UIElement> factory, int column, IEnumerable <object> parameters)
        {
            UIElement newElement = factory.CreateElement(app, window, parameters);

            grid.Children.Add(newElement);
            Grid.SetColumn(newElement, column);
        }
Пример #4
0
 public UI Create(string type)
 {
     try
     {
         UI         ui;
         IUIFactory uiFactory = uiMvcVessel.GetUIMvcVessel(UIMvcVesselType.Factory, type) as IUIFactory;
         if (uiFactory != null)
         {
             ui = uiFactory.Create(this.GetParent <Scene>(), type, Root);
         }
         else
         {
             UIView uiCommpoentView = uiMvcVessel.GetUIMvcVessel(UIMvcVesselType.Componet, type) as UIView;
             ui = DefaultUIFactory.Create(this.GetParent <Scene>(), type, Root, uiCommpoentView);
         }
         UIView uiView = ui.GetComponent <UIView>();
         uiView.pViewState = ViewState.CreateIn;//状态改为正在创建中
         Type t = uiView.GetType();
         ui.GameObject.transform.SetParent(this.Root.Get <GameObject>(uiView.pCavasName).transform, false);
         uiView.OnCrete(ui.GameObject);
         uis.Add(type, ui);
         uiViews.Add(uiView);
         return(ui);
     }
     catch (Exception e)
     {
         throw new Exception($"{type} UI 错误: {e}");
     }
 }
Пример #5
0
        public void Load()
        {
            UiTypes = new Dictionary <string, IUIFactory>();

            foreach (Type type in ETModel.Game.Hotfix.GetHotfixTypes())
            {
                var attrs = type.GetCustomAttributes(typeof(UIFactoryAttribute), false);
                if (attrs.Length == 0)
                {
                    continue;
                }

                UIFactoryAttribute attribute = attrs[0] as UIFactoryAttribute;
                if (UiTypes.ContainsKey(attribute.Type))
                {
                    Log.Debug($"已经存在同类UI Factory: {attribute.Type}");
                    throw new Exception($"已经存在同类UI Factory: {attribute.Type}");
                }

                object     o       = Activator.CreateInstance(type);
                IUIFactory factory = o as IUIFactory;
                if (factory == null)
                {
                    Log.Error($"{o.GetType().FullName} 没有继承 IUIFactory");
                    continue;
                }

                this.UiTypes.Add(attribute.Type, factory);
            }
        }
Пример #6
0
		public AGSDialogFactory(IContainer resolver, IGameState gameState, IUIFactory ui, IObjectFactory obj)
		{
			_resolver = resolver;
			_gameState = gameState;
			_ui = ui;
			_object = obj;
		}
        /// <summary>
        /// Gets additional feature
        /// </summary>
        /// <typeparam name="T">Feature type</typeparam>
        /// <param name="factory">User interface factory</param>
        /// <param name="obj">Obj</param>
        /// <returns>Feature</returns>
        static public object GetAdditionalFeature <T>(this IUIFactory factory, IAssociatedObject obj)
        {
            IUIFactory f = factory;
            IUIFactory p = factory.Parent;

            if (p != null)
            {
                f = p;
            }
            if (obj == null)
            {
                return(null);
            }
            if (obj is T)
            {
                return(f.GetAdditionalFeature <T>((T)obj));
            }
            if (obj is IChildrenObject) // If object has children
            {
                IAssociatedObject[] ao = (obj as IChildrenObject).Children;
                foreach (IAssociatedObject aa in ao) // Searches additional feature among children
                {
                    object ob = GetAdditionalFeature <T>(f, aa);
                    if (ob != null)
                    {
                        return(ob);
                    }
                }
            }
            return(null);
        }
Пример #8
0
        /// <summary>
        /// Load初始化 得到所有UI类型
        /// </summary>
        public void Load()
        {
            this.UiTypes.Clear();
            //找到所有有UIFactory特性的类
            List <Type> types = Game.EventSystem.GetTypes(typeof(UIFactoryAttribute));

            //遍历
            foreach (Type type in types)
            {
                //反射获得用户自定义属性
                object[] attrs = type.GetCustomAttributes(typeof(UIFactoryAttribute), false);
                if (attrs.Length == 0)
                {
                    continue;
                }

                UIFactoryAttribute attribute = attrs[0] as UIFactoryAttribute;                 //进行格式转换

                //attribute.Type是自定义的UI类型  用来区分UI

                if (UiTypes.ContainsKey(attribute.Type)) //判断字典中是否已经拥有此UI类型
                {
                    Log.Debug($"已经存在同类UI Factory: {attribute.Type}");
                    throw new Exception($"已经存在同类UI Factory: {attribute.Type}");
                }
                object     o       = Activator.CreateInstance(type);   //实例化
                IUIFactory factory = o as IUIFactory;                  //所有UI类型  都需继承IUIFactory 接口
                if (factory == null)
                {
                    Log.Error($"{o.GetType().FullName} 没有继承 IUIFactory");
                    continue;
                }
                this.UiTypes.Add(attribute.Type, factory);                  //添加到字典中
            }
        }
Пример #9
0
        public UIController(IGitHubServiceProvider gitHubServiceProvider,
                            IRepositoryHosts hosts, IUIFactory factory,
                            IConnectionManager connectionManager)
        {
            this.factory = factory;
            this.gitHubServiceProvider = gitHubServiceProvider;
            this.hosts             = hosts;
            this.connectionManager = connectionManager;

#if DEBUG
            if (Application.Current != null && !Splat.ModeDetector.InUnitTestRunner())
            {
                var waitDispatcher = RxApp.MainThreadScheduler as WaitForDispatcherScheduler;
                if (waitDispatcher != null)
                {
                    Debug.Assert(DispatcherScheduler.Current.Dispatcher == Application.Current.Dispatcher,
                                 "DispatcherScheduler is set correctly");
                }
                else
                {
                    Debug.Assert(((DispatcherScheduler)RxApp.MainThreadScheduler).Dispatcher == Application.Current.Dispatcher,
                                 "The MainThreadScheduler is using the wrong dispatcher");
                }
            }
#endif
            ConfigureLogicStates();

            uiStateMachine = new StateMachineType(UIViewType.None);

            ConfigureUIHandlingStates();
        }
Пример #10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="factory">The UI factory</param>
 public ToolsDiagram(IUIFactory factory)
 {
     StaticExtensionDiagramUISerializable.Init();
     handler       = new ToolBarButtonClickEventHandler(this.ToolBar_ButtonClick);
     this.factory  = factory;
     factory.Tools = this;
 }
Пример #11
0
        public UIController(IUIProvider uiProvider, IRepositoryHosts hosts, IUIFactory factory,
                            IConnectionManager connectionManager)
        {
            this.factory           = factory;
            this.uiProvider        = uiProvider;
            this.hosts             = hosts;
            this.connectionManager = connectionManager;
            uiObjects = new Dictionary <UIControllerFlow, Dictionary <UIViewType, IUIPair> >();

#if DEBUG
            if (Application.Current != null && !Splat.ModeDetector.InUnitTestRunner())
            {
                var waitDispatcher = RxApp.MainThreadScheduler as WaitForDispatcherScheduler;
                if (waitDispatcher != null)
                {
                    Debug.Assert(DispatcherScheduler.Current.Dispatcher == Application.Current.Dispatcher,
                                 "DispatcherScheduler is set correctly");
                }
                else
                {
                    Debug.Assert(((DispatcherScheduler)RxApp.MainThreadScheduler).Dispatcher == Application.Current.Dispatcher,
                                 "The MainThreadScheduler is using the wrong dispatcher");
                }
            }
#endif
            machines = new Dictionary <UIControllerFlow, StateMachine <UIViewType, Trigger> >();
            ConfigureLogicStates();

            uiStateMachine = new StateMachineType(UIViewType.None);
            triggers       = new Dictionary <Trigger, StateMachineType.TriggerWithParameters <ViewWithData> >();
            ConfigureUIHandlingStates();
        }
Пример #12
0
        private void Load()
        {
            this.UiTypes = new Dictionary <UIType, IUIFactory>();

            Assembly[] assemblies = Game.EntityEventManager.GetAssemblies();
            foreach (Assembly assembly in assemblies)
            {
                Type[] types = assembly.GetTypes();
                foreach (Type type in types)
                {
                    object[] attrs = type.GetCustomAttributes(typeof(UIFactoryAttribute), false);
                    if (attrs.Length == 0)
                    {
                        continue;
                    }

                    UIFactoryAttribute attribute = attrs[0] as UIFactoryAttribute;
                    if (this.UiTypes.ContainsKey(attribute.Type))
                    {
                        throw new GameException($"已经存在同类UI Factory: {attribute.Type}");
                    }
                    IUIFactory iIuiFactory = Activator.CreateInstance(type) as IUIFactory;
                    if (iIuiFactory == null)
                    {
                        throw new GameException("UI Factory没有继承IUIFactory");
                    }
                    this.UiTypes.Add(attribute.Type, iIuiFactory);
                }
            }
        }
Пример #13
0
 public AGSComboBoxComponent(IUIFactory factory, IGameEvents gameEvents)
 {
     _uiFactory   = factory;
     _itemButtons = new List <IButton>();
     _items       = new AGSBindingList <object>(10);
     _items.OnListChanged.Subscribe(onListChanged);
     gameEvents.OnRepeatedlyExecute.Subscribe((_, __) => refreshDropDownLayout());
 }
 /// <summary>
 /// Adds a factory to the main factory
 /// </summary>
 /// <param name="factory">The factory to add</param>
 static public void Add(this IUIFactory factory)
 {
     if (UIFactory is AssemblyFactory)
     {
         AssemblyFactory f = UIFactory as AssemblyFactory;
         f.Add(factory);
     }
 }
Пример #15
0
 public AGSComboBoxComponent(IUIFactory factory, IGameEvents gameEvents)
 {
     _uiFactory = factory;
     _itemButtons = new List<IButton>();
     _items = new AGSBindingList<object>(10);
     _items.OnListChanged.Subscribe(onListChanged);
     gameEvents.OnRepeatedlyExecute.Subscribe((_, __) => refreshDropDownLayout());
 }
Пример #16
0
 public DefaultController(IDomainFactory domainFactory, INobleRepository nobleRepository, IInstituteRepository instituteRepository,
                          IUIFactory uifactory, ICommandProcessor commandProcessor)
 {
     this.domainFactory       = domainFactory;
     this.uiFactory           = uifactory;
     this.nobleRepository     = nobleRepository;
     this.instituteRepository = instituteRepository;
     this.commandProcessor    = commandProcessor;
 }
Пример #17
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="type">Type</param>
 /// <param name="kind">Kind</param>
 /// <param name="toolTipText">ToolTip</param>
 /// <param name="factory">Factory</param>
 /// <param name="buttonImage">Image</param>
 /// <param name="isVisible">The "is visible" sign</param>
 /// <param name="isArrow">The "is arrow" sign</param>
 public ButtonWrapper(Type type, string kind, string toolTipText, Image buttonImage, IUIFactory factory, bool isVisible, bool isArrow)
 {
     this.type        = type;
     this.stringKind  = kind;
     this.toolTipText = toolTipText;
     this.buttonImage = buttonImage;
     this.factory     = factory;
     this.isVisible   = isVisible;
     this.isArrow     = isArrow;
 }
Пример #18
0
 public AGSDialogFactory(Resolver resolver, IGameState gameState, IUIFactory ui, IObjectFactory obj,
                         IBrushLoader brushloader, IFontLoader fontLoader)
 {
     _resolver    = resolver;
     _brushLoader = brushloader;
     _fontLoader  = fontLoader;
     _gameState   = gameState;
     _ui          = ui;
     _object      = obj;
 }
Пример #19
0
        /// <summary>
        /// 获取组件下的工厂
        /// </summary>
        /// <param name="type">工厂属性</param>
        /// <returns></returns>
        public IUIFactory GetUIFactory(UIType type)
        {
            IUIFactory uIFactory = null;

            if (!this.UiTypes.TryGetValue(type, out uIFactory))
            {
                Log.Debug(string.Format("{0} 没有继承 IUIFactory", type));
            }
            return(uIFactory);
        }
Пример #20
0
 public AGSDialogFactory(Resolver resolver, IGameState gameState, IUIFactory ui, IObjectFactory obj,
                         IBrushLoader brushloader, IFontFactory fontLoader, IDialogSettings defaults)
 {
     _resolver    = resolver;
     _brushLoader = brushloader;
     _fontLoader  = fontLoader;
     _gameState   = gameState;
     _ui          = ui;
     _object      = obj;
     _defaults    = defaults;
 }
Пример #21
0
 public CreatePollCommand(IUIFactory uif, IPollFactory pollFactory, VotingRepository repository)
 {
     //if (name is null)
     //{
     //    Title = this.GetType().Name;
     //}
     Title            = GetType().Name;
     factory          = uif;
     this.pollFactory = pollFactory;
     repo             = repository;
 }
Пример #22
0
		public AGSGameFactory(IGraphicsFactory graphics, IInventoryFactory inventory, IUIFactory ui,
			IRoomFactory room, IOutfitFactory outfit, IObjectFactory obj, IDialogFactory dialog, IAudioFactory sound)
		{
			Graphics = graphics;
			Inventory = inventory;
			UI = ui;
			Room = room;
			Outfit = outfit;
			Object = obj;
			Dialog = dialog;
			Sound = sound;
		}
        /// <summary>
        /// Sets control of the object
        /// </summary>
        /// <param name="categoryObject">The object</param>
        /// <param name="control">The control</param>
        /// <returns>True in case of succces and false otherwise</returns>
        static public bool SetControl(this ICategoryObject categoryObject, Control control)
        {
            IUIFactory     factory = StaticExtensionDiagramUIFactory.UIFactory;
            IObjectLabelUI label   = factory.CreateLabel(categoryObject);

            if (label == null)
            {
                return(false);
            }
            label.SetControl(control);
            return(true);
        }
Пример #24
0
        /// <summary>
        ///     Create a <see cref="TaskVisualizerFactory" /> with the given amount of <see cref="maxElements" />
        ///     and a <see cref="showMoreFactory" />.
        /// </summary>
        /// <param name="maxElements">The amount of maximum <see cref="CustomControls.StatusBar.TaskVisualizer" />.</param>
        /// <param name="showMoreFactory">
        ///     The factory that will be used to generate the "show more indicator". May not be <c>null</c>.
        ///     i.e. If too many tasks are concurrently running, it has to be indicated that there are more tasks running
        ///     than displayed.
        /// </param>
        public TaskVisualizerFactory(int maxElements, IUIFactory <UIElement> showMoreFactory)
        {
            if (showMoreFactory == null)
            {
                throw new ArgumentNullException(nameof(showMoreFactory));
            }

            _maxElements           = maxElements;
            _visualizationManagers = new WeakList <IWpfTaskVisualizationManager>();

            _showMoreFactory = showMoreFactory;
        }
Пример #25
0
        public Loginform()
        {
            eventMediator = new EventMediator();
            // feliratkozás az ErrorMessage Event-re
            // hibaüzenet esetén az OnErrorMessage metódus megjeleníti a hibaüzenetet
            eventMediator.ErrorMessage += OnErrorMessage;

            FactorySupport factorySupport = new FactorySupport();

            Directory.CreateDirectory(@"C:\Log");
            Log.Logger = new LoggerConfiguration().WriteTo.File(@"C:\Log\Log.txt", rollingInterval: RollingInterval.Hour).CreateLogger();
            Directory.CreateDirectory(@"C:\db");
            LiteRepository repo = new LiteRepository(ApplicationConfig.DbConnectionString);

            frameWork = factorySupport.Create(isMySQL, repo, eventMediator);

            // példa: lekéri a GetService() -vel a UIFactory szervízt
            // utána kirajzol egy button-t a felhasználói felületen.

            uiFactory = (IUIFactory)(frameWork.GetService(typeof(IUIFactory)));

            if (uiFactory == null)
            {
                throw new Exception("Hibás UIFactory!");
            }

            // Betölti az egész adatbázist a memóriába
            //MessageBox.Show("Beolvasom az adatbázist a memóriába");
            frameWork.LoadDatabase();


            // példa: lekéri a GetService() -vel az IErrorservice szervízt
            // utána megjeleníti a hibaüzenetet

            IErrorService errorService = (IErrorService)(frameWork.GetService(typeof(IErrorService)));

            if (errorService == null)
            {
                throw new Exception("Hibás ErrorService!");
            }

            /*IError error = new Error(ErrorType.InputError, "Példa a beviteli hibára");
             * errorService.Write(error);
             *
             * // hibeüzenet 2. példa
             * IError errorExample2 = new Error(ErrorType.DatabaseError, "Példa: Adatbázis üzenet a datalayertől");
             * errorService.Write(errorExample2);*/

            userService = (IUserService)(frameWork.GetService(typeof(IUserService)));

            InitializeComponent();
        }
Пример #26
0
 public FrameWork(IDataService dataService,
                  ILogService logService, IErrorService errorService, IUserService userService)
 {
     this.dataService   = dataService;
     this.logService    = logService;
     this.errorService  = errorService;
     this.userService   = userService;
     registerConnection = new RegisterConnection(logService, errorService);
     registerActive     = new RegisterActive(logService, errorService);
     registerPortActive = new RegisterPortActive(logService, errorService);
     registerSymbol     = new RegisterSymbol(logService, errorService);
     uiFactory          = new UIFactory();
 }
Пример #27
0
        private static void BuildUI(IUIFactory factory)         //... type of platform
        {
            /*
             *                  Call your method for platform here
             */
            IGrid grid = factory.CreateGrid();

            IButton button1 = factory.CreateButton();

            button1.Content = "BigPurpleButton";
            IButton button2 = factory.CreateButton();

            button2.Content = "SmallButton";
            IButton button3 = factory.CreateButton();

            button3.Content = "Baton";

            grid.AddButton(button1);
            grid.AddButton(button2);
            grid.AddButton(button3);


            ITextBox textBox1 = factory.CreateTextBox();

            textBox1.Content = "";
            ITextBox textBox2 = factory.CreateTextBox();

            textBox2.Content = "EmptyTextBox";
            ITextBox textBox3 = factory.CreateTextBox();

            textBox3.Content = "xoBtxeT";

            grid.AddTextBox(textBox1);
            grid.AddTextBox(textBox2);
            grid.AddTextBox(textBox3);

            var buttons = grid.GetButtons();

            foreach (var b in buttons)
            {
                b.ButtonPressed();
                b.DrawContent();
            }

            var textBoxes = grid.GetTextBoxes();

            foreach (var t in textBoxes)
            {
                t.DrawContent();
            }
        }
Пример #28
0
 public AGSGameFactory(IGraphicsFactory graphics, IInventoryFactory inventory, IUIFactory ui,
                       IRoomFactory room, IOutfitFactory outfit, IObjectFactory obj, IDialogFactory dialog,
                       IAudioFactory sound, IFontLoader fontFactory)
 {
     Graphics  = graphics;
     Inventory = inventory;
     UI        = ui;
     Room      = room;
     Outfit    = outfit;
     Object    = obj;
     Dialog    = dialog;
     Sound     = sound;
     Fonts     = fontFactory;
 }
Пример #29
0
        /// <summary> Connects a device. </summary>
        /// <param name="serialNo"> The serial no. </param>
        private void ConnectDevice(string serialNo)
        {
            // unload device if not desired type
            if (_genericDevice != null)
            {
                if (_genericDevice.CoreDevice.DeviceID == serialNo)
                {
                    return;
                }
                DisconnectDevice();
            }

            // create new device
            IGenericCoreDeviceCLI device  = DeviceFactory.CreateDevice(serialNo);
            GenericDeviceHolder   devices = new GenericDeviceHolder(device);

            _genericDevice = devices[1];
            if (_genericDevice == null)
            {
                MessageBox.Show("Unknown Device Type");
                return;
            }

            // connect device
            try
            {
                _genericDevice.CoreDevice.Connect(serialNo);

                // wait for settings to be initialized
                _genericDevice.Device.WaitForSettingsInitialized(5000);
            }
            catch (DeviceException ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            // create view via factory
            // get factory
            IUIFactory factory = DeviceManager.GetUIFactory(_genericDevice.CoreDevice.DeviceID);

            // create and initialize view model for device
            IDeviceViewModel viewModel = factory.CreateViewModel(DisplayTypeEnum.Full, _genericDevice);

            viewModel.Initialize();

            // create view and attach to our display
            _contentControl.Content = factory.CreateLargeView(viewModel);
        }
Пример #30
0
            public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
            {
                string[]          tabs = new string[] { "General", "6D Motion", "Arrows" };
                ButtonWrapper[][] but  = new ButtonWrapper[tabs.Length][];
                int i = 0;
                List <ButtonWrapper> gen = new List <ButtonWrapper>();

                gen.AddRange(DataPerformer.UI.Factory.StaticFactory.GeneralObjectsButtons);
                // gen.AddRange(ControlSystems.Data.UI.Factory.ControlSystemsFactory.ObjectButtons);
                but[i] = gen.ToArray();
                ++i;
                List <ButtonWrapper> geom = new List <ButtonWrapper>();

                //geom.AddRange(Motion6D.UI.Factory.MotionFactory.ObjectButtons);
                // geom.AddRange(Motion6D.UI.Factory.VisibleFactory.GetVisualObjectButtons(factory));
                but[i] = geom.ToArray();
                ++i;
                List <ButtonWrapper> arr = new List <ButtonWrapper>();

                arr.AddRange(EngineeringUIFactory.ArrowButtons);
                arr.AddRange(Motion6D.UI.Factory.MotionFactory.ArrowButtons);
                arr.AddRange(Motion6D.UI.Factory.VisibleFactory.VisualArrowButtons);
                but[i] = arr.ToArray();
                LightDictionary <string, ButtonWrapper[]> buttons = new LightDictionary <string, ButtonWrapper[]>();

                buttons.Add(tabs, but);
                IUIFactory[] factories = new IUIFactory[]
                {
                    // ControlSystems.Data.UI.Factory.ControlSystemsFactory.Object,
                };
                IApplicationInitializer[] init = new IApplicationInitializer[]
                {
                };

                Dictionary <string, object>[] d = Motion6D.UI.Utils.ControlUtilites.Resources;

                ByteHolder holder = value as ByteHolder;
                FormMain   m      = MotionApplicationCreator.CreateForm(null, holder,
                                                                        OrdinaryDifferentialEquations.Runge4Solver.Singleton,
                                                                        DataPerformer.Portable.DifferentialEquationProcessors.RungeProcessor.Processor, init, factories, true, buttons,
                                                                        Properties.Resources.Aviation,
                                                                        null, null, Motion6D.UI.Utils.ControlUtilites.Resources,
                                                                        "Astronomy + OpenGL",
                                                                        ".cfa", "Astronomy configuration files |*.cfa", null, null);

                m.ShowDialog();
                return(m.Creator.Holder);
            }
Пример #31
0
        /// <summary>
        /// This method invokes the initialisation of the panel (after it has been addded).
        /// </summary>
        public void Initialise(WPFWindow window)
        {
            if (UseLoadingIndicator)
            {
                _loadingIndicator = LoadingIndicatorFactory.CreateElement(window.App, window, this);
                ShowLoadingIndicator();
            }
            LoadingIndicatorFactory = null;

            if (window is SigmaWindow)
            {
                OnInitialise((SigmaWindow)window);
            }

            OnInitialise(window);
        }
Пример #32
0
        protected void AddLegends(Application app, Window window, Grid grid, IUIFactory <UIElement> factory,
                                  IEnumerable <object> parameters)
        {
            StackPanel stackPanel = new StackPanel
            {
                Orientation         = Orientation.Horizontal,
                HorizontalAlignment = HorizontalAlignment.Right
            };

            foreach (object legendInfo in parameters)
            {
                UIElement element = factory.CreateElement(app, window, legendInfo);
                stackPanel.Children.Add(element);
            }

            grid.Children.Add(stackPanel);
            Grid.SetColumn(stackPanel, _legendColumn);
        }
Пример #33
0
        /// <summary>
        /// </summary>
        /// <param name="app"></param>
        /// <param name="window"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public UIElement CreateElement(Application app, Window window, params object[] parameters)
        {
            IUIFactory <UIElement> customFactory         = EnsureRegistry(CustomFactoryIdentifier, null);
            IUIFactory <UIElement> taskVisualizerFactory = EnsureRegistry(TaskVisualizerFactoryIdentifier,
                                                                          () => new TaskVisualizerFactory(3));
            IUIFactory <UIElement> legendFactory = EnsureRegistry(LegendFactoryIdentifier, () => new StatusBarLegendFactory());

            Grid statusBarGrid = new Grid
            {
                Height     = _height,
                Background = UIResources.WindowTitleColorBrush
            };

            // Add a column for every specified column
            foreach (GridLength gridLength in _gridLengths)
            {
                ColumnDefinition newColumn = new ColumnDefinition
                {
                    Width = new GridLength(gridLength.Value, gridLength.GridUnitType)
                };

                statusBarGrid.ColumnDefinitions.Add(newColumn);
            }

            if (_customColumn >= 0 && customFactory != null)
            {
                AddCustom(app, window, statusBarGrid, customFactory, parameters);
            }

            if (_taskColumn >= 0)
            {
                AddTaskVisualizer(app, window, statusBarGrid, taskVisualizerFactory, parameters);
            }

            if (_legendColumn >= 0)
            {
                AddLegends(app, window, statusBarGrid, legendFactory, parameters);
            }


            return(statusBarGrid);
        }
 public ConfigurationFormController(IFacade facade, IUIFactory uiFactory)
 {
     facadeImpl = facade;
     this.uiFactory = uiFactory;
     settings = facade.CreateConfiguration();
 }
 public override void SetUp()
 {
     base.SetUp();
     uiFactoryMock = MockRepository.StrictMock<IUIFactory>();
 }