コード例 #1
0
        public void AddReceiver(ReceiverBase receiver)
        {
            receiver.LogReaderFactory = _logReaderFactory;
            if (string.IsNullOrEmpty(receiver.LogFormat))
            {
                receiver.LogFormat = LogazmicSettings.Instance.LogFormat;
            }

            if (!LogazmicSettings.Instance.Receivers.Contains(receiver))
            {
                LogazmicSettings.Instance.Receivers.Add(receiver);
            }

            var logPaneViewModel = new LogPaneViewModel(receiver);

            logPaneViewModel.Deactivated += OnTabDeactivated;
            Items.Add(logPaneViewModel);
            ActivateItem(logPaneViewModel);
            Task.Factory.StartNew(logPaneViewModel.Initialize).ContinueWith(t =>
            {
                if (t.Exception != null)
                {
                    LogazmicSettings.Instance.Receivers.Remove(receiver);
                }
            });
        }
コード例 #2
0
        private void ServerFormLoad(object sender, System.EventArgs e)
        {
            Receiver = new ServerReceiver(this);

            textBoxServer.Text = Receiver.AddListener($"tcp://{Dns.GetHostName()}:55833").Uri.ToString();
            textBoxUdp.Text    = Receiver.AddListener($"udp://{Dns.GetHostName()}").Uri.ToString();

            Receiver.Start();
        }
コード例 #3
0
ファイル: LogPaneViewModel.cs プロジェクト: cqxumin/Logazmic
        public LogPaneViewModel([NotNull] ReceiverBase receiver)
        {
            if (receiver == null)
            {
                throw new ArgumentNullException(nameof(receiver));
            }

            Receiver = receiver;
            var filtersProfile = new FiltersProfile();

            LogMessages.CollectionChanged += LogMessagesOnCollectionChanged;

            ProfileFiltersViewModel     = new ProfileFiltersViewModel(filtersProfile, LogPaneServices);
            filterLogic                 = new FilterLogic(filtersProfile);
            ProfilesFiltersViewModel    = new ProfilesFiltersViewModel(filtersProfile, LogPaneServices);
            searchTextChangedSubscriber = ProfileFiltersViewModel.SubscribeToPropertyChanged(vm => vm.SearchText, OnSearchTextChanged);

            ProfilesFiltersViewModel.ActivateWith(this);

            LogPaneServices.EventAggregator.Subscribe(this);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: 1301536601/DesignModeDemo
 public ConcreteCommand(ReceiverBase receiver) : base(receiver)
 {
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: 1301536601/DesignModeDemo
 public Command(ReceiverBase receiver)
 {
     Receiver = receiver;
 }
コード例 #6
0
 private Dictionary <int, Action> m_handlers = new Dictionary <int, Action>(); //Action<Msg> 具体Msg结构为消息的结构
 // Use this for initialization
 void Start()
 {
     ReceiverBase receiverBase = new ReceiverBase(this);
 }
コード例 #7
0
        public override void OnInspectorGUI()
        {
            ReceiverBase receiver = target as ReceiverBase;

            DrawDefaultInspector();
            Object projector = receiver.customProjector;

            if (projector == null)
            {
                projector = receiver.unityProjector;
            }
            Component newProjector = EditorGUILayout.ObjectField("Projector", projector, typeof(Component), true) as Component;

            if (newProjector != projector)
            {
                if (newProjector == null)
                {
                    Undo.RecordObject(receiver, "Inspector");
                    receiver.unityProjector  = null;
                    receiver.customProjector = null;
                }
                else
                {
                    Projector unityProjector = newProjector.GetComponent <Projector>();
                    Renderer  renderer       = receiver.GetComponent <Renderer>();
                    Material  material       = renderer.sharedMaterial;
                    if (unityProjector != null)
                    {
                        Undo.RecordObject(receiver, "Inspector");
                        receiver.unityProjector = unityProjector;
                        if (material == null || material == editorSettings.m_defaultShadowmapReceiverMaterial)
                        {
                            Undo.RecordObject(renderer, "Inspector");
                            renderer.sharedMaterial = editorSettings.m_defaultReceiverMaterial;
#if (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7) // support Unity 4.3 or later
                            renderer.castShadows = false;
#else
                            renderer.shadowCastingMode    = UnityEngine.Rendering.ShadowCastingMode.Off;
                            renderer.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off;
#endif
                            renderer.useLightProbes = false;
                            renderer.receiveShadows = false;
                        }
                    }
                    else
                    {
                        ProjectorBase projectorBase = newProjector.GetComponent <ProjectorBase>();
                        if (projectorBase != null)
                        {
                            Undo.RegisterCompleteObjectUndo(receiver, "Inspector");
                            receiver.customProjector = projectorBase;
                            if (material == null || material == editorSettings.m_defaultReceiverMaterial)
                            {
                                Undo.RecordObject(renderer, "Inspector");
                                renderer.sharedMaterial = editorSettings.m_defaultShadowmapReceiverMaterial;
#if (UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7) // support Unity 4.3 or later
                                renderer.castShadows = false;
#else
                                renderer.shadowCastingMode    = UnityEngine.Rendering.ShadowCastingMode.Off;
                                renderer.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off;
#endif
                                renderer.useLightProbes = false;
                                renderer.receiveShadows = true;
                            }
                        }
                    }
                }
            }
            // check errors
            string errorMessage = null;
            if (projector == null)
            {
                // check if the object is prefab or not.
                PrefabType type = PrefabUtility.GetPrefabType(receiver.gameObject);
                if (type != PrefabType.Prefab && type != PrefabType.ModelPrefab)
                {
                    // check if there is ProjectorManager and the receiver is add to it.
                    ProjectorManager proman = Object.FindObjectOfType <ProjectorManager>();
                    if (proman != null)
                    {
                        if (!proman.receivers.Contains(receiver))
                        {
                            errorMessage = "<color=red>Projector has not been set! There is a ProjectorManager in the scene. Do you forget to add this shadow receiver into the ProjectorManager?</color>";
                        }
                    }
                    else
                    {
                        errorMessage = "<color=red>Projector has not been set! Shadow receiver will not work until a Projector is assigned.</color>";
                    }
                }
            }
            else if (projector is Projector)
            {
                if ((((Projector)projector).ignoreLayers & (1 << receiver.gameObject.layer)) != 0)
                {
                    errorMessage = "<color=red>This shadow receiver is being ignored by the Projector. Cannot receive the shadow from the Projector. Please check the layer of this object and Ignore Layers of the Projector.</color>";
                }
            }
            if (!string.IsNullOrEmpty(errorMessage))
            {
                GUILayout.TextArea(errorMessage, errorStyle);
            }
        }