/// <summary>
        /// Setups the data.
        /// </summary>
        private void SetupData()
        {
            Domain.Dependencies.Register();
            DataAccess.Dependencies.Register();

            Workstation ws = DIContainer.Instance.Resolve<Workstation>();

            ws.Port = new Port { PortId = "1" };
            ws.Ship = new Ship { ShipId = "1" };
            ws.GangwayLocation = new GangwayLocation { LocationId = "1" };
            ws.GangwayServiceBaseAddress = "http://Localhost/";
            ws.ConnectionMode = ConnectionMode.Online;
            ws.ConfigurationServiceBaseAddress = "http://Localhost/";
            ws.AuthenticationServiceBaseAddress = "http://Localhost/";
            ws.AuthorizationServiceBaseAddress = "http://Localhost/";

            this.configurationServiceRepositoryMock = new Mock<ConfigurationServiceRepository>();

            ComponentSettingCollection componentSettingCollection = new ComponentSettingCollection();

            ComponentSetting comp = new ComponentSetting();
            comp.Id = "123";
            comp.Name = "rohit";
            comp.DataType = "454";
            comp.Value = "4654";
            componentSettingCollection.Add(comp);

            DIContainer.Instance.RegisterInstance<ConfigurationServiceRepository>(this.configurationServiceRepositoryMock.Object);
            this.configurationServiceRepositoryMock.Setup(data => data.RetrieveComponentSettingAsync(It.IsAny<string>(), It.IsAny<string>())).Returns(Task.FromResult(componentSettingCollection));
        }
Ejemplo n.º 2
0
        private static Dictionary <string, List <ComponentSetting> > GetComponentSettingsFromElement(Element LayoutElement)
        {
            Dictionary <string, List <ComponentSetting> > result = new Dictionary <string, List <ComponentSetting> >();

            if (LayoutElement == null)
            {
                return(result);
            }

            foreach (var item in LayoutElement.childNodes.item)
            {
                if (item.nodeType == enumNodeType.ELEMENT)
                {
                    Element child = item as Element;

                    if (child.tagName == "position" || child.tagName == "placeholder")
                    {
                        string positionname = child.id;
                        if (string.IsNullOrEmpty(positionname))
                        {
                            positionname = child.getAttribute("name");
                        }
                        if (string.IsNullOrEmpty(positionname))
                        {
                            continue;
                        }

                        List <ComponentSetting> settingList;
                        if (result.ContainsKey(positionname))
                        {
                            settingList = result[positionname];
                        }
                        else
                        {
                            settingList          = new List <ComponentSetting>();
                            result[positionname] = settingList;
                        }


                        foreach (var comNodeItem in child.childNodes.item)
                        {
                            if (comNodeItem.nodeType == enumNodeType.ELEMENT)
                            {
                                Element comElement = comNodeItem as Element;
                                if (Manager.IsComponent(comElement))
                                {
                                    var setting = ComponentSetting.LoadFromElement(comElement);
                                    settingList.Add(setting);
                                }
                            }
                        }
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 3
0
        public ComponentRenderTask(Element element)
        {
            this.setting = ComponentSetting.LoadFromElement(element);

            if (this.setting.Settings.ContainsKey("nocache"))
            {
                this.setting.Settings.Remove("nocache");
                this.NonCache = true;
            }
        }
Ejemplo n.º 4
0
        public ServerComponentRenderTask(Element element)
        {
            this.setting = ComponentSetting.LoadFromElement(element);
            if (this.setting.Settings.Any() || this.setting.TagAttributes.Any())
            {
                data = new Dictionary <string, string>();

                foreach (var item in this.setting.TagAttributes)
                {
                    data.Add(item.Key, item.Value);
                }

                foreach (var item in this.setting.Settings)
                {
                    data[item.Key] = item.Value;
                }
            }
        }
        /// <summary>
        /// Maps the configuration data.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <returns>The component setting collection</returns>
        internal static async Task<ComponentSettingCollection> MapConfigurationData(SqlDataReader dataReader)
        {
            var componentSettingCollection = new ComponentSettingCollection();
            if (dataReader != null)
            {
                while (await dataReader.ReadAsync())
                {
                    var ComponentSettings = new ComponentSetting
                    {
                        Id = dataReader.GuidField(Id).ToString(),
                        Name = dataReader.StringField(Name),
                        Value = dataReader.StringField(Value)
                    };

                    componentSettingCollection.Add(ComponentSettings);
                }
            }

            return componentSettingCollection;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="control"></param>
        /// <param name="setting"></param>
        public ComponentSettingsPage(PathwayControl control, ComponentSetting setting)
            : base()
        {
            InitializeComponent();

            m_con = control;
            m_manager = control.ComponentManager;
            this.Text = setting.Type;
            commonComponentItem.Setting = setting;

            //this.SuspendLayout();
            //int top = 0;
            //foreach (ComponentSetting cs in m_manager.DefaultComponentSettings)
            //{
            //    ComponentItem item = new ComponentItem(cs);
            //    item.Top = top;
            //    item.SuspendLayout();
            //    this.Controls.Add(item);
            //    item.ResumeLayout();
            //    item.PerformLayout();
            //    top += item.Height;
            //}
            //this.ResumeLayout();
        }
Ejemplo n.º 7
0
 //Window
 void OnGUI()
 {
     gameObject       = (GameObject)EditorGUILayout.ObjectField(gameObject, typeof(GameObject), true);
     gameObjectIsNull = (gameObject == null);
     if (gameObjectIsNull)
     {
         GUILayout.Label("Requires a game object to search", EditorStyles.boldLabel);
     }
     addToSelection = EditorGUILayout.Toggle("Add To Current Selection", addToSelection);
     GUILayout.Label("Care about", EditorStyles.boldLabel);
     if (gameObjectIsNull)
     {
         //comment for debugging
         //GUI.enabled = false;
     }
     ToggleLeft("Name", ref careAboutName);
     if (careAboutName)
     {
         nameSetting = (NameSetting)EditorGUILayout.EnumPopup(nameSetting);
         if (nameSetting == NameSetting.Contains)
         {
             nameContains = EditorGUILayout.TextField(nameContains);
         }
     }
     ToggleLeft("Tag", ref careAboutTag);
     ToggleLeft("Layer", ref careAboutLayer);
     ToggleLeft("Position", ref careAboutPosition);
     if (careAboutPosition)
     {
         positionGlobalSetting = (GlobalSetting)EditorGUILayout.EnumPopup(positionGlobalSetting);
         positionSetting       = (Vector3Setting)EditorGUILayout.EnumPopup(positionSetting);
         if (positionSetting == Vector3Setting.Within)
         {
             Vector3Field("+ or - of GameObject on each axis", ref positionWithin);
         }
         else if (positionSetting == Vector3Setting.Between)
         {
             Vector3Field("Starting Value", ref positionBetween[0]);
             Vector3Field("Ending Value", ref positionBetween[1]);
         }
     }
     ToggleLeft("Rotation", ref careAboutRotation);
     if (careAboutRotation)
     {
         rotationSetting = (Vector3Setting)EditorGUILayout.EnumPopup(rotationSetting);
         if (rotationSetting == Vector3Setting.Within)
         {
             Vector3Field("+ or - of GameObject on each axis", ref rotationWithin);
         }
         else if (rotationSetting == Vector3Setting.Between)
         {
             Vector3Field("Starting Value", ref rotationBetween[0]);
             Vector3Field("Ending Value", ref rotationBetween[1]);
         }
     }
     ToggleLeft("Scale", ref careAboutScale);
     if (careAboutScale)
     {
         scaleGlobalSetting = (GlobalSetting)EditorGUILayout.EnumPopup(scaleGlobalSetting);
         scaleSetting       = (Vector3Setting)EditorGUILayout.EnumPopup(scaleSetting);
         if (scaleSetting == Vector3Setting.Within)
         {
             Vector3Field("+ or - of GameObject on each axis", ref scaleWithin);
         }
         else if (scaleSetting == Vector3Setting.Between)
         {
             Vector3Field("Starting Value", ref scaleBetween[0]);
             Vector3Field("Ending Value", ref scaleBetween[1]);
         }
     }
     ToggleLeft("Active", ref careAboutActive);
     if (careAboutActive)
     {
         activeSetting     = (ActiveSetting)EditorGUILayout.EnumPopup(activeSetting);
         activeBoolSetting = (BoolSetting)EditorGUILayout.EnumPopup(activeBoolSetting);
     }
     ToggleLeft("Components", ref careAboutComponents);
     if (careAboutComponents)
     {
         componentSetting = (ComponentSetting)EditorGUILayout.EnumPopup(componentSetting);
         ToggleLeft("Allow inherited components", ref allowInheritedComponents);
         ToggleLeft("Care about values", ref careAboutComponentValues);
     }
     if (GUILayout.Button("Search"))
     {
         Select(Filter(GetAllGameObjects()));
         //UnityEditor.Selection.gameObjects
     }
 }
Ejemplo n.º 8
0
        public static Models.View RaiseViewEvent(enumEventType eventtype, RenderContext context, ComponentSetting setting, Models.View view = null)
        {
            if (eventtype == enumEventType.ViewFinding)
            {
                ViewFinding finding = new ViewFinding(context, setting);
                RaiseEvent(context, finding);
                return(finding.View);
            }
            else if (eventtype == enumEventType.ViewFound)
            {
                if (view != null)
                {
                    ViewFound found = new ViewFound(context, setting, view);

                    RaiseEvent(context, found);

                    if (found.DataChange && found.View != null)
                    {
                        return(found.View);
                    }
                }
            }
            else if (eventtype == enumEventType.ViewNotFound)
            {
                ViewNotFound notfound = new ViewNotFound(context, setting);
                RaiseEvent(context, notfound);
                return(notfound.View);
            }
            return(null);
        }
Ejemplo n.º 9
0
 public ComponentRenderTask(Element element)
 {
     this.setting = ComponentSetting.LoadFromElement(element);
 }
Ejemplo n.º 10
0
 public ViewFound(RenderContext context, ComponentSetting comsetting, View View)
 {
     this.Context          = context;
     this._view            = View;
     this.componentSetting = comsetting;
 }
Ejemplo n.º 11
0
 public ViewFinding(RenderContext context, ComponentSetting comsetting)
 {
     this.Context          = context;
     this.componentSetting = comsetting;
 }
Ejemplo n.º 12
0
 public ViewNotFound(RenderContext context, ComponentSetting ComSettings)
 {
     this.Context          = context;
     this.componentSetting = ComSettings;
 }