Exemplo n.º 1
0
        /// <summary>
        /// Compare property values of two specified Settings objects.
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public virtual Boolean Equals(ISettingsComponent other)
        {
            Boolean returnValue = default(Boolean);
            SettingsComponentBase otherSettings = default(SettingsComponentBase);

            try
            {
                otherSettings = other as SettingsComponentBase;

                if (this == otherSettings)
                {
                    returnValue = true;
                }
                else
                {
                    if (false /*this.Xxx != otherSettings.Xxx*/)
                    {
                        returnValue = false;
                    }
                    else
                    {
                        returnValue = true;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error);
                throw;
            }

            return(returnValue);
        }
Exemplo n.º 2
0
 protected override void AwakeOverride()
 {
     WindowType = RuntimeWindowType.Custom;
     base.AwakeOverride();
     m_settings     = IOC.Resolve <ISettingsComponent>();
     m_localization = IOC.Resolve <ILocalization>();
 }
Exemplo n.º 3
0
        private void StartSystem()
        {
            // Bind handlers
            Exit += App_Exit;
            DispatcherUnhandledException += App_DispatcherUnhandledException;

            // Create system objects
            foregroundWindowHook = new ForegroundWindowHook();
            windowUpdateHook     = new WindowUpdateHook();
            mouseHook            = new ClipMouseHook();
            appSystem            = new AppSystem(foregroundWindowHook, windowUpdateHook, mouseHook);
            windowEnumerator     = new WindowEnumerator();

            // Create components
            lockingComponent     = new LockingComponent(appSystem);
            toolbarComponent     = new ToolbarComponent();
            windowListComponent  = new WindowListComponent(windowEnumerator);
            findProgramComponent = new FindProgramComponent();
            lockWindowComponent  = new LockWindowComponent(appSystem);
            aboutComponent       = new AboutComponent();
            settingsComponent    = new SettingsComponent();
            mainWindowComponent  = new MainWindowComponent(appSystem);

            // Create gui system
            guiSystem = new GuiSystem(lockingComponent, toolbarComponent, windowListComponent, findProgramComponent, lockWindowComponent, aboutComponent, settingsComponent, mainWindowComponent);
            guiSystem.Startup();
        }
        protected override void AwakeOverride()
        {
            WindowType = RuntimeWindowType.Inspector;
            base.AwakeOverride();

            m_editorsMap        = IOC.Resolve <IEditorsMap>();
            m_settingsComponent = IOC.Resolve <ISettingsComponent>();

            Editor.Selection.SelectionChanged += OnRuntimeSelectionChanged;
            CreateEditor();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Compare property values of two specified Settings objects.
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public override Boolean Equals(ISettingsComponent other)
        {
            Boolean     returnValue   = default(Boolean);
            MVCSettings otherSettings = default(MVCSettings);

            try
            {
                otherSettings = other as MVCSettings;

                if (this == otherSettings)
                {
                    returnValue = true;
                }
                else
                {
                    if (!base.Equals(other))
                    {
                        returnValue = false;
                    }
                    else if (!this.SomeComponent.Equals(otherSettings))
                    {
                        returnValue = false;
                    }
                    else if (this.SomeInt != otherSettings.SomeInt)
                    {
                        returnValue = false;
                    }
                    else if (this.SomeBoolean != otherSettings.SomeBoolean)
                    {
                        returnValue = false;
                    }
                    else if (this.SomeString != otherSettings.SomeString)
                    {
                        returnValue = false;
                    }
                    else
                    {
                        returnValue = true;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error);
                throw;
            }

            return(returnValue);
        }
Exemplo n.º 6
0
 // Constructor
 public GuiSystem(ILockingComponent lockingComponent,
                  IToolbarComponent toolbarComponent,
                  IWindowListComponent windowListComponent,
                  IFindProgramComponent findProgramComponent,
                  ILockWindowComponent lockWindowComponent,
                  IAboutComponent aboutComponent,
                  ISettingsComponent settingsComponent,
                  IMainWindowComponent mainWindowComponent)
 {
     _lockingComponent     = lockingComponent;
     _toolbarComponent     = toolbarComponent;
     _windowListComponent  = windowListComponent;
     _findProgramComponent = findProgramComponent;
     _lockWindowComponent  = lockWindowComponent;
     _aboutComponent       = aboutComponent;
     _settingsComponent    = settingsComponent;
     _mainWindowComponent  = mainWindowComponent;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Copies property values from source working fields to detination working fields, then optionally syncs destination.
        /// </summary>
        /// <param name="destination"></param>
        /// <param name="sync"></param>
        public override void CopyTo(ISettingsComponent destination, Boolean sync)
        {
            MVCSettingsComponent destinationSettings = default(MVCSettingsComponent);

            try
            {
                destinationSettings = destination as MVCSettingsComponent;

                destinationSettings.SomeOtherInt     = this.SomeOtherInt;
                destinationSettings.SomeOtherBoolean = this.SomeOtherBoolean;
                destinationSettings.SomeOtherString  = this.SomeOtherString;

                base.CopyTo(destination, sync);//also checks and optionally performs sync
            }
            catch (Exception ex)
            {
                Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error);
                throw;
            }
        }
        /// <summary>
        /// Copies property values from source working fields to detination working fields, then optionally syncs destination.
        /// <param name="destinationSettings"></param>
        /// <param name="sync"></param>
        /// </summary>
        public override void CopyTo(ISettingsComponent destination, Boolean sync)
        {
            Settings destinationSettings = default(Settings);

            try
            {
                destinationSettings = destination as Settings;

                destinationSettings.Sheets  = this.Sheets;
                destinationSettings.Version = this.Version;

                base.CopyTo(destination, sync);//also checks and optionally performs sync
            }
            catch (Exception ex)
            {
                Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error);

                throw;
            }
        }
Exemplo n.º 9
0
        protected override void AwakeOverride()
        {
            WindowType = RuntimeWindowType.Inspector;
            base.AwakeOverride();

            if (m_gameObjectEditor == null)
            {
                Debug.LogError("GameObjectEditor is not set");
            }
            if (m_materialEditor == null)
            {
                Debug.LogError("MaterialEditor is not set");
            }

            m_editorsMap        = IOC.Resolve <IEditorsMap>();
            m_settingsComponent = IOC.Resolve <ISettingsComponent>();

            Editor.Selection.SelectionChanged += OnRuntimeSelectionChanged;
            CreateEditor();
        }
Exemplo n.º 10
0
        /// <summary>
        /// Copies property values from source working fields to detination working fields, then optionally syncs destination.
        /// </summary>
        /// <param name="destination"></param>
        /// <param name="sync"></param>
        public virtual void CopyTo(ISettingsComponent destination, Boolean sync)
        {
            ISettingsComponent destinationSettings = default(ISettingsComponent);

            try
            {
                destinationSettings = destination as ISettingsComponent;

                //destinationSettings.Xxx = this.Xxx;

                if (sync)
                {
                    destinationSettings.Sync();
                }
            }
            catch (Exception ex)
            {
                Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error);
                throw;
            }
        }
        protected override void OnEditorExist()
        {
            base.OnEditorExist();
            IOC.RegisterFallback <IMeasurementTools>(this);

            m_editor = IOC.Resolve <IRuntimeEditor>();
            m_editor.Tools.ToolChanged += OnToolChanged;

            m_settingsComponent = IOC.Resolve <ISettingsComponent>();
            if (m_settingsComponent != null)
            {
                m_settingsComponent.SystemOfMeasurementChanged += OnSystemOfMeasurementChanged;
            }

            if (m_distanceTool == null)
            {
                GameObject go = new GameObject("MeasureDistanceTool");
                go.transform.SetParent(transform, false);
                go.SetActive(false);

                m_distanceTool = go.AddComponent <MeasureDistanceTool>();
                //if(m_output != null)
                //{
                //    m_distanceTool.Output = m_output;
                //}
            }

            if (m_angleTool == null)
            {
                GameObject go = new GameObject("MeasureAngleTool");
                go.transform.SetParent(transform, false);
                go.SetActive(false);

                m_angleTool = go.AddComponent <MeasureAngleTool>();
                //if (m_output != null)
                //{
                //    m_angleTool.Output = m_output;
                //}
            }
        }
Exemplo n.º 12
0
        public virtual HeaderDescriptor GetHeaderDescriptor(IRTE editor)
        {
            ILocalization          localization      = IOC.Resolve <ILocalization>();
            ISettingsComponent     settingsComponent = IOC.Resolve <ISettingsComponent>();
            BuiltInWindowsSettings settings;

            if (settingsComponent == null)
            {
                settings = BuiltInWindowsSettings.Default;
            }
            else
            {
                settings = settingsComponent.BuiltInWindowsSettings;
            }


            return(new HeaderDescriptor(
                       localization.GetString("ID_RTEditor_CD_" + ComponentType.Name, ComponentType.Name),
                       settings.Inspector.ComponentEditor.ShowExpander,
                       settings.Inspector.ComponentEditor.ShowResetButton,
                       settings.Inspector.ComponentEditor.ShowEnableButton));
        }
Exemplo n.º 13
0
 protected override void AwakeOverride()
 {
     m_settings = IOC.Resolve <ISettingsComponent>();
     base.AwakeOverride();
 }
Exemplo n.º 14
0
        public void BuildEditor()
        {
            IComponentDescriptor componentDescriptor = GetComponentDescriptor();

            if (componentDescriptor != null)
            {
                m_converter = componentDescriptor.CreateConverter(this);
            }

            PropertyDescriptor[] descriptors = m_editorsMap.GetPropertyDescriptors(Component.GetType(), this, m_converter);
            if (descriptors == null || descriptors.Length == 0)
            {
                if (ExpanderGraphics != null)
                {
                    ExpanderGraphics.SetActive(false);
                }

                return;
            }

            ISettingsComponent     settingsComponent = IOC.Resolve <ISettingsComponent>();
            BuiltInWindowsSettings settings;

            if (settingsComponent == null)
            {
                settings = BuiltInWindowsSettings.Default;
            }
            else
            {
                settings = settingsComponent.BuiltInWindowsSettings;
            }

            if (ResetButton != null)
            {
                ResetButton.gameObject.SetActive(componentDescriptor != null ?
                                                 componentDescriptor.GetHeaderDescriptor(m_editor).ShowResetButton :
                                                 settings.Inspector.ComponentEditor.ShowResetButton);
            }

            if (RemoveButton != null)
            {
                bool showRemoveButton = componentDescriptor != null?
                                        componentDescriptor.GetHeaderDescriptor(m_editor).ShowRemoveButton:
                                        settings.Inspector.ComponentEditor.ShowRemoveButton;

                if (showRemoveButton)
                {
                    bool canRemove = m_project == null || m_project.ToAssetItem(Component.gameObject) == null;
                    if (!canRemove)
                    {
                        showRemoveButton = false;
                    }
                }

                RemoveButton.gameObject.SetActive(showRemoveButton);
            }

            if (EnabledEditor != null && EnabledProperty != null)
            {
                EnabledEditor.gameObject.SetActive(componentDescriptor != null ?
                                                   componentDescriptor.GetHeaderDescriptor(m_editor).ShowEnableButton :
                                                   settings.Inspector.ComponentEditor.ShowEnableButton);
            }

            if (Expander == null)
            {
                BuildEditor(componentDescriptor, descriptors);
            }
            else
            {
                if (componentDescriptor != null ? !componentDescriptor.GetHeaderDescriptor(m_editor).ShowExpander : !settings.Inspector.ComponentEditor.ShowExpander)
                {
                    Expander.isOn    = true;
                    Expander.enabled = false;
                }

                if (Expander.isOn)
                {
                    if (ExpanderGraphics != null)
                    {
                        ExpanderGraphics.SetActive(componentDescriptor != null ? componentDescriptor.GetHeaderDescriptor(m_editor).ShowExpander : settings.Inspector.ComponentEditor.ShowExpander);
                    }
                    BuildEditor(componentDescriptor, descriptors);
                }
            }
        }