コード例 #1
0
        private async Task EnableEvents(ViewConfig configuration)
        {
            var variables = configuration.Tabs.SelectMany(t => t.Items.Select(it => it.Variable)).Distinct().ToArray();
            await Connection.DisableChangeEvents();

            await Connection.EnableVariableHistoryChangedEvents(variables);
        }
コード例 #2
0
        public void Init(ViewConfig elementConfig)
        {
            if (elementConfig is ElementConfig)
            {
                this.elementConfig = elementConfig as ElementConfig;
                name = elementConfig.Name;

                foreach (var attribute in BeforeInitAttribute(this.elementConfig.Attributes))
                {
                    MB2CustomEditorView view;
                    if (!ElementViewManager.GetView(attribute.Type, out view))
                    {
                        view = new NotSupportView();
                    }
                    view.Init(attribute);

                    attributeViews.Add(attribute.Name, view);
                }
                AfterInitAttribute(attributeViews);

                foreach (var element in BeforeInitNestedElement(this.elementConfig.NestedElements))
                {
                    MB2CustomEditorView view;
                    if (!ElementViewManager.GetView(element.Name, out view))
                    {
                        view = new ElementView();
                    }
                    view.Init(element);
                    nestedElementExpanded.Add(element.Name, true);
                    nestedElementViews.Add(element.Name, view);
                }
                AfterInitNestedElement(nestedElementViews);
            }
        }
コード例 #3
0
        public static void UpdateWindowState(this ViewConfig config, Window main)
        {
            if (config.WindowStates == null)
            {
                return;
            }

            var monitor = GetScreens(main.Screens);

            if (config.WindowStates.Top < monitor.Height && config.WindowStates.Left < monitor.Width)
            {
                main.WindowState = (AvaloniaWindowState)Enum.Parse(typeof(ConfigWindowState), config.WindowStates.WindowState.ToString(), true);
                if (config.WindowStates.CanShow)
                {
                    main.Position = new PixelPoint((int)config.WindowStates.Left, (int)config.WindowStates.Top);
                    main.Width    = config.WindowStates.Width;
                    main.Height   = config.WindowStates.Height;
                }
            }

            // TODO #115 Partialy realized.
            //void OnDisplaySettingsChanged(object sender, EventArgs args) => UpdateWindowState(config, main);
            //Microsoft.Win32.SafeHandles.DisplaySettingsChanged -= OnDisplaySettingsChanged;
            //Microsoft.Win32.SystemEvents.DisplaySettingsChanged += OnDisplaySettingsChanged;
        }
コード例 #4
0
        public static void UpdateWindowState(this ViewConfig config, Window main)
        {
            if (config.WindowStates == null)
            {
                return;
            }

            var monitor = Monitors.FullScreen();

            if (config.WindowStates.Top < monitor.Height && config.WindowStates.Left < monitor.Width)
            {
                main.WindowState = (System.Windows.WindowState)Enum.Parse(typeof(WindowState), config.WindowStates.WindowState.ToString(), true);
                if (config.WindowStates.CanShow)
                {
                    main.Top    = config.WindowStates.Top;
                    main.Left   = config.WindowStates.Left;
                    main.Width  = config.WindowStates.Width;
                    main.Height = config.WindowStates.Height;
                }
            }
            void OnDisplaySettingsChanged(object sender, EventArgs args) => UpdateWindowState(config, main);

            Microsoft.Win32.SystemEvents.DisplaySettingsChanged -= OnDisplaySettingsChanged;
            Microsoft.Win32.SystemEvents.DisplaySettingsChanged += OnDisplaySettingsChanged;
        }
コード例 #5
0
 public GameContext(MonoBehaviour view, ViewConfig viewConfig, int contextId) : base(view,
                                                                                     true)
 {
     _viewConfig            = viewConfig;
     _contextId             = contextId;
     _enemyInstanceProvider = new EnemyInstanceProvider();
 }
コード例 #6
0
ファイル: TowaryAtrybutyView.cs プロジェクト: Ogiss/AbakTools
 public TowaryAtrybutyView(BAL.Forms.IMenuItem menuItem)
 {
     if (menuItem != null && menuItem.ActionAttribute.Data != null)
     {
         this.viewConfig = new ViewConfig(menuItem.ActionAttribute.Data.ToString());
     }
 }
コード例 #7
0
        private static DataValue ConfigToIndentedDataValue(ViewConfig configuration)
        {
            string json = StdJson.ObjectToString(configuration, indented: true);
            string c    = "\r\n" + Indent(json, 8) + "\r\n      ";

            return(DataValue.FromJSON(c));
        }
コード例 #8
0
 protected override void RegisterTypes(IContainerRegistry containerRegistry)
 {
     ViewConfig.Init(containerRegistry);
     ServiceConfig.Init(containerRegistry);
     containerRegistry.RegisterForNavigation <CowListPage>();
     containerRegistry.RegisterForNavigation <ParameterPage>();
 }
コード例 #9
0
ファイル: View_Calc.cs プロジェクト: ifakFAST/Mediator.Net
 public override Task OnActivate()
 {
     if (Config.NonEmpty)
     {
         configuration = Config.Object <ViewConfig>() ?? new ViewConfig();
     }
     return(Task.FromResult(true));
 }
コード例 #10
0
 private static List <TabState> GetInitialTabStates(ViewConfig configuration)
 {
     return(configuration.Tabs.Select(t => new TabState()
     {
         TabName = t.Name,
         Variables = t.Items.Select(it => it.Variable).ToArray()
     }).ToList());
 }
コード例 #11
0
ファイル: Global.asax.cs プロジェクト: ducnguyenht/DEVXAF
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     ViewConfig.AdjustViewEngines(ViewEngines.Engines);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     //ControllerBuilder.Current.EnableCodeRouting();
 }
コード例 #12
0
    private void Start()
    {
        viewConfig = Resources.Load <ViewConfig>("ViewConfig");//Load the ViewConfig scriptable object from the Resources folder
        Debug.Assert(viewConfig != null);

        Inventory.OnMoneyChanged += updateMoneyPanel;

        updateMoneyPanel();
    }
コード例 #13
0
        internal void InitViewMeta()
        {
            if (this._ViewMeta == null)
            {
                this._ViewMeta = UIModel.Views.Create(this.EntityType, ViewConfig.GetViewName(this.ExtendView));

                this.UseBlockDefaultCommands(this._ViewMeta);
            }
        }
コード例 #14
0
        public async Task Initialize()
        {
            ViewConfig = await ConfigRepository.GetViewConfig();

            if (ViewConfig.SelectedFileSystemItem == default(Guid))
            {
                ViewConfig.SelectedFileSystemItem = InputStreamItem.Key;
            }
        }
コード例 #15
0
    /// <summary>
    /// 初始化Canvas
    /// </summary>
    private void Awake()
    {
        ViewConfig.Init();
        var canvas = GameObjectManager.Instance.SyncSpawn(CANVASPATH);

        canvas.transform.SetParent(transform, false);
        mCanvas  = canvas.GetComponent <RectTransform>();
        UICamera = mCanvas.transform.Find("UICamera").GetComponent <Camera>();
    }
コード例 #16
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                  Initialize()
 //------------------------------------------------------------------------------------------------------------------------
 //Override Initialize to set up additional information needed by this concrete controller: number of columns in the view
 public override ShopController Initialize(ShopModel pShopModel)
 {
     base.Initialize(pShopModel);                                  //Call base.Initialize to set up the model
     currentItemIndex = model.GetSelectedItemIndex();              //Synchronize the current item index with the model
     viewConfig       = Resources.Load <ViewConfig>("ViewConfig"); //Load the ViewConfig scriptable object from the Resources folder
     Debug.Assert(viewConfig != null);
     columnCount        = viewConfig.gridViewColumnCount;          //Try to set up the column count, fails silently
     _viewSwitchHandler = FindObjectOfType <ViewSwitchHandler>();
     return(this);
 }
コード例 #17
0
        public override Task OnActivate()
        {
            if (Config.NonEmpty)
            {
                configuration = Config.Object <ViewConfig>();
            }

            tabStates = GetInitialTabStates(configuration);

            return(Task.FromResult(true));
        }
コード例 #18
0
 protected void Application_Start()
 {
     AutofacConfig.Configure();
     GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
     GlobalConfiguration.Configuration.Filters.Add(new LogExceptionFilterAttribute());
     AreaRegistration.RegisterAllAreas();
     ViewConfig.Configure();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
コード例 #19
0
    /// <summary>
    /// 创建View
    /// </summary>
    private BaseView Create <T>(params object[] data) where T : BaseView, new()
    {
        var path = ViewConfig.GetViewPath(typeof(T));
        var go   = GameObjectManager.Instance.SyncSpawn(path);

        go.transform.SetParent(mCanvas, false);
        var view = new T();

        view.Create(go, data);
        mViewDict.Add(view.UniqueId, view);
        return(view);
    }
コード例 #20
0
            public void SettingSave()
            {
                if (_fe is Window)
                {
                    ViewConfig.Save((Window)_fe);

                    Settings.Default.FontConfig.FamilyName = FontFamilyName;
                    Settings.Default.FontConfig.Size       = FontSize;
                    Settings.Default.TextEncoding          = TextEncoding;

                    Settings.Default.Save();
                }
            }
コード例 #21
0
 protected override void ConfigureViewFields() // Выбор и агрегация полей объекта, которые будут отображаться на форме
 {
     ViewConfig.Add("Название", () => Name);
     ViewConfig.Add("Дата открытия", () => Date == null ? Constants.UNKNOWN : Date.ToString());
     ViewConfig.Add("Первооткрывыатель", () => SDiscoverer == null ? Constants.UNKNOWN : SDiscoverer.Name);
     ViewConfig.Add("Созвездие", () => StarAsterism == null ? "-" : StarAsterism.Name);
     ViewConfig.Add("Расстояние", () => Distance);
     ViewConfig.Add("Масса", () => Mass == null ? Constants.UNKNOWN : Mass.ToString());
     ViewConfig.Add("Минимальная температура", () => TMin);
     ViewConfig.Add("Максимальная температура", () => TMax);
     //ViewConfig.Add("Цвет", () => VisColor);
     ViewConfig.Add("Содержание веществ", () => String.Join("\n", SubstancesPercentage.Select(S => S.Key.ToString() + ": " + S.Value.ToString())));
 }
コード例 #22
0
ファイル: ViewManager.cs プロジェクト: Niller/Pong
    public void Initialize(ViewConfig viewConfig)
    {
        _config = viewConfig;
        var orthographicSize = Camera.main.orthographicSize;
        var aspectRatio      = (float)Screen.width / Screen.height;

        _pitchSize = new Vector2(aspectRatio * (orthographicSize * 2f), orthographicSize * 2f - _config.PaddleYOffset * 2f);

        SignalBus.Subscribe <GameStartedSignal>(OnGameStarted);
        SignalBus.Subscribe <BallSpawnSignal>(OnBallSpawn);
        SignalBus.Subscribe <BallDespawnSignal>(OnBallDespawn);
        SignalBus.Subscribe <MatchStopSignal>(OnMatchStop);
    }
コード例 #23
0
ファイル: Boxes.cs プロジェクト: BHoM/BHoM_Engine
        /***************************************************/

        private static void SetScales(this Boxes component, Dataset dataset, ViewConfig viewConfig)
        {
            BHoMGroup <IBHoMObject> entityGroup = (BHoMGroup <IBHoMObject>)dataset.Data.Find(x => x.Name == "Entities");
            List <IBHoMObject>      entities    = entityGroup.Elements;

            //set scales
            List <object> viewX = new List <object>()
            {
                0, viewConfig.Width
            };
            List <object> viewY = new List <object>()
            {
                0, viewConfig.Height
            };
            object allGroupNames = entities.PropertyValue(component.Group);
            var    groups        = Convert.ToDataList(allGroupNames).GroupBy(n => n);

            if (groups.Count() == 0)
            {
                Reflection.Compute.RecordError("No groups could be defined with the supplied property name: " + component.Group + ".");
                return;
            }

            int           maxGroup    = groups.Max(g => g.Count());
            List <object> colourNames = Graphics.Convert.ToDataList(entities.PropertyValue(component.Colour));

            if (component.IsHorizontal)
            {
                //group for x scale
                m_Xscale = Create.IScale(new List <object>()
                {
                    0, maxGroup
                }, viewX);
                m_Yscale = Create.IScale(groups.Select(g => g.Key).ToList(), viewY);
            }
            else
            {
                //group for y scale
                m_Xscale = Create.IScale(groups.Select(g => g.Key).ToList(), viewX);
                m_Yscale = Create.IScale(new List <object>()
                {
                    0, maxGroup
                }, viewY);
            }

            Gradient gradient = Create.Gradient();

            m_Colourscale = Create.IScale(colourNames, gradient.Markers.Values.Cast <object>().ToList());
        }
コード例 #24
0
        public App(IAppLifetimeInput appLifetimeInput, ViewConfig viewConfig)
        {
            Instance   = this;
            ViewConfig = viewConfig;

            InitLogging();

            InitHubs();
            if (appLifetimeInput != null)
            {
                InputHub.RegisterInput(appLifetimeInput);
            }

            InitSceneNavigator();
        }
コード例 #25
0
ファイル: PlayMain.cs プロジェクト: lisyaoran51/MyRhythmGame
        private void InitializeView()
        {
            ViewConfig viewConfig = new ViewConfig();

            viewConfig.Set("StraightPlayField", new View()
            {
            })
            .Set("Column", new View()
            {
            })
            .Set("DrawableNote", new View()
            {
            });

            Cache(viewConfig);
        }
コード例 #26
0
        public static void UpdateWindowState(this ViewConfig config, Window main)
        {
            if (config.WindowStates == null)
            {
                return;
            }

            main.WindowState = (System.Windows.WindowState)Enum.Parse(typeof(WindowState), config.WindowStates.WindowState.ToString(), true);
            if (config.WindowStates.CanShow)
            {
                main.Top    = config.WindowStates.Top;
                main.Left   = config.WindowStates.Left;
                main.Width  = config.WindowStates.Width;
                main.Height = config.WindowStates.Height;
            }
        }
コード例 #27
0
        public static void SaveWindowState(this ViewConfig config, Window main)
        {
            if (config.WindowStates == null)
            {
                config.WindowStates = new WindowStates();
            }

            var state = (WindowState)Enum.Parse(typeof(System.Windows.WindowState), main.WindowState.ToString(), true);

            if (state != WindowState.Minimized)
            {
                config.WindowStates.WindowState = state;
                config.WindowStates.Top         = main.Top;
                config.WindowStates.Left        = main.Left;
                config.WindowStates.Width       = main.Width;
                config.WindowStates.Height      = main.Height;
            }
        }
コード例 #28
0
        public static void SaveWindowState(this ViewConfig config, Window main)
        {
            if (config.WindowStates == null)
            {
                config.WindowStates = new WindowStates();
            }

            var state = (ConfigWindowState)Enum.Parse(typeof(AvaloniaWindowState), main.WindowState.ToString(), true);

            if (state != ConfigWindowState.Minimized)
            {
                config.WindowStates.WindowState = state;
                config.WindowStates.Top         = main.Position.Y;
                config.WindowStates.Left        = main.Position.X;
                config.WindowStates.Width       = main.Bounds.Width;
                config.WindowStates.Height      = main.Bounds.Height;
            }
        }
コード例 #29
0
        public override async Task OnActivate()
        {
            if (Config.NonEmpty)
            {
                configuration = Config.Object <ViewConfig>() ?? new ViewConfig();
            }

            tabStates = GetInitialTabStates(configuration);

            string[] exclude = configuration.ExcludeModules;
            var      mods    = await Connection.GetModules();

            modules = mods
                      .Where(m => !exclude.Contains(m.ID))
                      .Select(m => new ModuleInfo()
            {
                ID   = m.ID,
                Name = m.Name
            }).ToArray();
        }
コード例 #30
0
        public void Init(ViewConfig config)
        {
            if (config is ElementConfig && (config as ElementConfig).IsContainer)
            {
                elementConfig = config as ElementConfig;
                string nameSpace = elementConfig.DataSetConfig.NameSpace;
                var    filters   = elementConfig.NestedElements.Select((element) => "l: " + element.Name + "@" + nameSpace);

                if (filters.Any())
                {
                    filter = string.Join(" ", filters);
                }
                else
                {
                    filter = null;
                }
            }

            ForceUpdate();
        }