Пример #1
0
        /// <inheritdoc/>
        public IObservable <bool> GetActivationForView(IActivatable view)
        {
            var fe = view as FrameworkElement;

            if (fe == null)
            {
                return(Observable <bool> .Empty);
            }

            var viewLoaded = Observable.FromEventPattern <RoutedEventHandler, RoutedEventArgs>(
                x => fe.Loaded += x,
                x => fe.Loaded -= x)
                             .Select(_ => true);

            var hitTestVisible = Observable.FromEventPattern <DependencyPropertyChangedEventHandler, DependencyPropertyChangedEventArgs>(
                x => fe.IsHitTestVisibleChanged += x,
                x => fe.IsHitTestVisibleChanged -= x)
                                 .Select(x => (bool)x.EventArgs.NewValue);

            var viewUnloaded = Observable.FromEventPattern <RoutedEventHandler, RoutedEventArgs>(
                x => fe.Unloaded += x,
                x => fe.Unloaded -= x)
                               .Select(_ => false);

            return(viewLoaded
                   .Merge(viewUnloaded)
                   .Merge(hitTestVisible)
                   .DistinctUntilChanged());
        }
Пример #2
0
    // Load the game.
    public void Load()
    {
        if (File.Exists(saveGameName))
        {
            // 1 - deserialize the save game information.
            XmlSerializer serializer = new XmlSerializer(typeof(SaveGame));
            FileStream    stream     = File.Open(saveGameName, FileMode.Open);
            Game = serializer.Deserialize(stream) as SaveGame;
            stream.Dispose();

            // 2 - any setup after loading data.
            InstantiateState(true);

            // 3 - restart the any objects
            foreach (Transform child in SceneRoot.transform)
            {
                GameObject   go       = child.gameObject;
                IActivatable activate = go.GetComponent(typeof(IActivatable)) as IActivatable;
                if (activate != null)
                {
                    activate.SetEnabled(true);
                }
            }
            Debug.Log("Game Loaded");
        }
    }
Пример #3
0
        /// <inheritdoc/>
        public IObservable <bool> GetActivationForView(IActivatable view)
        {
            // Startup: Control.HandleCreated > Control.BindingContextChanged > Form.Load > Control.VisibleChanged > Form.Activated > Form.Shown
            // Shutdown: Form.Closing > Form.FormClosing > Form.Closed > Form.FormClosed > Form.Deactivate
            // https://docs.microsoft.com/en-us/dotnet/framework/winforms/order-of-events-in-windows-forms
            if (view is Control control)
            {
                if (GetCachedIsDesignMode(control))
                {
                    return(Observable <bool> .Empty);
                }

                var handleDestroyed = Observable.FromEventPattern(control, "HandleDestroyed").Select(_ => false);
                var handleCreated   = Observable.FromEventPattern(control, "HandleCreated").Select(_ => true);
                var visibleChanged  = Observable.FromEventPattern(control, "VisibleChanged").Select(_ => control.Visible);

                var controlActivation = Observable.Merge(handleDestroyed, handleCreated, visibleChanged)
                                        .DistinctUntilChanged();

                if (view is Form form)
                {
                    var formClosed = Observable.FromEventPattern(form, "FormClosed").Select(_ => false);
                    controlActivation = controlActivation.Merge(formClosed)
                                        .DistinctUntilChanged();
                }

                return(controlActivation);
            }

            // Show a friendly warning in the log that this view will never be activated
            this.Log().Warn("Expected a view of type System.Windows.Forms.Control but it is {0}.\r\nYou need to implement your own IActivationForViewFetcher for {0}.", view.GetType());

            return(Observable <bool> .Empty);
        }
Пример #4
0
    public override void _Ready()
    {
        Target = GetNode(ActivatableTargetNodePath) as IActivatable;            // Note: Could be null!

        CSGBox = GetNode <CSGBox>(CSGNodePath);
        SetColour(NotPressedColor);
    }
        public IObservable <bool> GetActivationForView(IActivatable view)
        {
            var fe = view as FrameworkElement;

            if (fe == null)
            {
                return(Observable <bool> .Empty);
            }
#if WINDOWS_UWP
            var viewLoaded = WindowsObservable.FromEventPattern <FrameworkElement, object>(x => fe.Loading += x,
                                                                                           x => fe.Loading -= x).Select(_ => true);
#else
            var viewLoaded = Observable.FromEventPattern <RoutedEventHandler, RoutedEventArgs>(x => fe.Loaded += x,
                                                                                               x => fe.Loaded -= x).Select(_ => true);
#endif

            var viewUnloaded = Observable.FromEventPattern <RoutedEventHandler, RoutedEventArgs>(x => fe.Unloaded += x,
                                                                                                 x => fe.Unloaded -= x).Select(_ => false);

            return(viewLoaded
                   .Merge(viewUnloaded)
                   .Select(b => b ? fe.WhenAnyValue(x => x.IsHitTestVisible).SkipWhile(x => !x) : Observables.False)
                   .Switch()
                   .DistinctUntilChanged());
        }
Пример #6
0
    public int bulletCount;      // inspector

    protected override void Awake()
    {
        base.Awake();
        activatable = GetComponent <GunActivatable>();
        // equipable.SetEquipableClass(EquipableClass.HandItem);
        magazineCount = 0;
    }
Пример #7
0
        /// <inheritdoc/>
        public IObservable <bool> GetActivationForView(IActivatable view)
        {
            var fe = view as FrameworkElement;

            if (fe == null)
            {
                return(Observable <bool> .Empty);
            }

#pragma warning disable SA1114 // Parameter list after.
#if NETSTANDARD
            var viewLoaded = Observable.FromEvent <RoutedEventHandler, bool>(
#else
            var viewLoaded = Observable.FromEvent <TypedEventHandler <DependencyObject, object>, bool>(
#endif
                eventHandler => (_, __) => eventHandler(true),
                x => fe.Loading += x,
                x => fe.Loading -= x);

            var viewUnloaded = Observable.FromEvent <RoutedEventHandler, bool>(
                handler =>
            {
                void EventHandler(object sender, RoutedEventArgs e) => handler(false);
                return(EventHandler);
            },
                x => fe.Unloaded += x,
                x => fe.Unloaded -= x);

            return(viewLoaded
                   .Merge(viewUnloaded)
                   .Select(b => b ? fe.WhenAnyValue(x => x.IsHitTestVisible).SkipWhile(x => !x) : Observables.False)
                   .Switch()
                   .DistinctUntilChanged());
        }
Пример #8
0
        public IObservable<bool> GetActivationForView(IActivatable view)
        {
            var control = view as Control;
            if (control == null) {
                // Show a friendly warning in the log that this view will never be activated
                this.Log().Warn("Expected a view of type System.Windows.Forms.Control but it is {0}.\r\nYou need to implement your own IActivationForViewFetcher for {0}.", view.GetType());
                return Observable.Empty<bool>();
            }

            // Create an observable stream of booleans
            // true representing the control is active, false representing the control is not active
            // by using DistinctUntilChanged, a control can either be active or not active
            // This should also fix #610 for winforms

            var controlVisible = Observable.FromEventPattern(control, "VisibleChanged").Select(_ => control.Visible);
            var handleDestroyed = Observable.FromEventPattern(control, "HandleDestroyed").Select(_ => false);
            var handleCreated = Observable.FromEventPattern(control, "HandleCreated").Select(_ => true);

            var controlActive = Observable.Merge(controlVisible, handleDestroyed, handleCreated)
                .DistinctUntilChanged();

            

            var form = view as Form;
            if (form != null) {
                var formActive = Observable.FromEventPattern(form, "Closed").Select(_ => false);
                return controlActive.Merge(formActive).DistinctUntilChanged();
            }

            return controlActive;
        }
Пример #9
0
        public IObservable <bool> GetActivationForView(IActivatable view)
        {
            var control = view as Control;

            if (control == null)
            {
                // Show a friendly warning in the log that this view will never be activated
                this.Log().Warn("Expected a view of type System.Windows.Forms.Control but it is {0}.\r\nYou need to implement your own IActivationForViewFetcher for {0}.", view.GetType());
                return(Observable <bool> .Empty);
            }

            // Create an observable stream of booleans
            // true representing the control is active, false representing the control is not active
            // by using DistinctUntilChanged, a control can either be active or not active
            // This should also fix #610 for winforms

            var controlVisible  = Observable.FromEventPattern(control, "VisibleChanged").Select(_ => control.Visible);
            var handleDestroyed = Observable.FromEventPattern(control, "HandleDestroyed").Select(_ => false);
            var handleCreated   = Observable.FromEventPattern(control, "HandleCreated").Select(_ => true);

            var controlActive = Observable.Merge(controlVisible, handleDestroyed, handleCreated)
                                .DistinctUntilChanged();



            var form = view as Form;

            if (form != null)
            {
                var formActive = Observable.FromEventPattern(form, "Closed").Select(_ => false);
                return(controlActive.Merge(formActive).DistinctUntilChanged());
            }

            return(controlActive);
        }
Пример #10
0
        public static void RegisterWidgetVariants(this IComponentsApplicationBuilder appBuilder)
        {
            IWidgetFactory widgetFactory = appBuilder.Services.GetService <IWidgetFactory>();

            widgetFactory.Register(WidgetVariants.SHOW_WIDGET, new WidgetVariant <ButtonWidgetMediator, ButtonWidgetPresenter>
            {
                Customisation = new ButtonWidgetCustomisation
                {
                    // Hind: Example of usage of strategy (delegate) in widget mediator
                    Title         = "Activate text widget in first container!",
                    ClickStrategy = () =>
                    {
                        // Hind: Manual widget build and activation, in most of cases would be easier to use IWidgetManagementService
                        WidgetInfo info = widgetFactory.Build(WidgetVariants.TEXT_FIRST);
                        IActivatable <string> activatable = (IActivatable <string>)info.Mediator;
                        activatable.Activate("FIRST_WIDGET_CONTAINER");
                    }
                }
            });

            var textVariant = new CustomisedWidgetVariant <TextWidgetMediator, TextWidgetCustomisation>();

            textVariant.Customisation.Text = "This text has been activated from runtime!";
            widgetFactory.Register(WidgetVariants.TEXT_FIRST, textVariant);

            widgetFactory.Register(WidgetVariants.RANDOM_UPDATER, new WidgetVariant <RandomUpdaterWidgetMediator>());

            widgetFactory.Register(WidgetVariants.COUNTER, new WidgetVariant <CounterWidgetMediator, CounterWidgetPresenter, CounterWidgetState>());

            widgetFactory.Register(WidgetVariants.LAYOUT, new WidgetVariant(typeof(ExampleLayoutWidget))
            {
                StateType = typeof(LayoutState)
            });
        }
Пример #11
0
 protected void AddExtraEntities(int type, int amountOfEntities)
 {
     for (int i = EntityDic.Count; i < amountOfEntities + EntityDic.Count; i++)
     {
         IActivatable c = CreateEntity(type);
         EntityDic[type].Insert(0, c);
     }
 }
Пример #12
0
 /// <summary>
 /// WhenActivated allows you to register a Func to be called when a
 /// View is Activated.
 /// </summary>
 /// <param name="This">Object that supports activation.</param>
 /// <param name="block">The method to be called when the corresponding
 /// View is activated. The Action parameter (usually called 'd') allows
 /// you to register Disposables to be cleaned up when the View is
 /// deactivated (i.e. "d(someObservable.Subscribe());")</param>
 /// <param name="view">The IActivatable will ordinarily also host the View
 /// Model, but in the event it is not, a class implementing <see cref="IViewFor" />
 /// can be supplied here.
 /// <returns>A Disposable that deactivates this registration.</returns>
 public static IDisposable WhenActivated(this IActivatable This, Action <Action <IDisposable> > block, IViewFor view)
 {
     return(This.WhenActivated(() => {
         var ret = new List <IDisposable>();
         block(ret.Add);
         return ret;
     }, view));
 }
Пример #13
0
 /// <summary>
 /// WhenActivated allows you to register a Func to be called when a
 /// View is Activated.
 /// </summary>
 /// <param name="This">Object that supports activation.</param>
 /// <param name="block">The method to be called when the corresponding
 /// View is activated. The Action parameter (usually called 'disposables') allows
 /// you to collate all disposables that should be cleaned up during deactivation.</param>
 /// <param name="view">The IActivatable will ordinarily also host the View
 /// Model, but in the event it is not, a class implementing <see cref="IViewFor" />
 /// can be supplied here.
 /// <returns>A Disposable that deactivates this registration.</returns>
 public static IDisposable WhenActivated(this IActivatable This, Action <CompositeDisposable> block, IViewFor view = null)
 {
     return(This.WhenActivated(() => {
         var d = new CompositeDisposable();
         block(d);
         return new[] { d };
     }, view));
 }
Пример #14
0
 public static void WhenActivated(this IActivatable instance, Action <CompositeDisposable> activate)
 {
     instance.WhenActivated(d => {
         var cd = new CompositeDisposable();
         activate(cd);
         d(cd);
     });
 }
Пример #15
0
 private void Start()
 {
     animator            = transform.parent.GetComponent <Animator> ();
     meshRenderer        = buttonBase.GetComponent <MeshRenderer> ();
     collider            = GetComponent <Collider> ();
     defaultColor        = meshRenderer.material.color;
     _targetIActivatable = targetActivatable.GetComponent <IActivatable> ();
 }
Пример #16
0
        public Tuple<IObservable<Unit>, IObservable<Unit>> GetActivationForView(IActivatable view)
        {
            var fe = view as Page;

            return Tuple.Create(
                Observable.FromEventPattern<EventHandler, EventArgs>(x => fe.Appearing += x, x => fe.Disappearing -= x).Select(_ => Unit.Default),
                Observable.FromEventPattern<EventHandler, EventArgs>(x => fe.Appearing += x, x => fe.Disappearing -= x).Select(_ => Unit.Default));
        }
Пример #17
0
 public static Db4objects.Db4o.Tests.Common.TA.MockActivator ActivatorFor(IActivatable
                                                                          obj)
 {
     Db4objects.Db4o.Tests.Common.TA.MockActivator activator = new Db4objects.Db4o.Tests.Common.TA.MockActivator
                                                                   ();
     obj.Bind(activator);
     return(activator);
 }
Пример #18
0
		public static Db4objects.Db4o.Tests.Common.TA.MockActivator ActivatorFor(IActivatable
			 obj)
		{
			Db4objects.Db4o.Tests.Common.TA.MockActivator activator = new Db4objects.Db4o.Tests.Common.TA.MockActivator
				();
			obj.Bind(activator);
			return activator;
		}
Пример #19
0
 public static MockActivator ActivatorFor(IActivatable
     obj)
 {
     var activator = new MockActivator
         ();
     obj.Bind(activator);
     return activator;
 }
 private void OnActivateLockerHandler(IActivatable activatable, ActivatableState state)
 {
     if (state != ActivatableState.Active)
     {
         return;
     }
     ReleaseHandlers(true);
 }
Пример #21
0
 public IObservable <bool> GetActivationForView(IActivatable view) =>
 Observable
 .CombineLatest(
     this.globalForce,
     this.EnsureSubjectFor(view),
     this.deferTo.GetActivationForView(view).StartWith(false),
     (forcedGlobally, forcedLocally, activated) => forcedGlobally || forcedLocally || activated)
 .DistinctUntilChanged();
 public bool RemovePassiveBehavior(ITrigger trigger, IActivatable response)
 {
     if (!passiveBehaviors.ContainsKey(trigger) || (response != null && passiveBehaviors [trigger] != response))
     {
         return(false);
     }
     passiveBehaviors.Remove(trigger);
     return(true);
 }
Пример #23
0
 private static void OnWindowDeactivateHandler(IActivatable activatable, ActivatableState state)
 {
     if (state != ActivatableState.Inactive)
     {
         return;
     }
     activatable.ActivatableStateChangedEvent -= OnWindowDeactivateHandler;
     Destroy(((IWindow)activatable).Canvas.gameObject);
 }
Пример #24
0
 public IGroup GetReference(IActivatable lightProvider)
 {
     lock (_lock)
     {
         GroupReference gRef = new GroupReference(Name, Lights, lightProvider);
         _referring.Add(new WeakReference<GroupReference>(gRef));
         return gRef;
     }
 }
Пример #25
0
        public static MockActivator ActivatorFor(IActivatable
                                                 obj)
        {
            var activator = new MockActivator
                                ();

            obj.Bind(activator);
            return(activator);
        }
        public static IObservable <bool> GetIsActivated(this IActivatable @this)
        {
            var activationForViewFetcher = Locator.Current.GetService <IActivationForViewFetcher>();

            return(activationForViewFetcher
                   .GetActivationForView(@this)
                   .Replay(1)
                   .RefCount());
        }
 public IActivatable AddPassiveBehavior(ITrigger trigger, IActivatable response)
 {
     if (passiveBehaviors.ContainsKey(trigger))
     {
         return(passiveBehaviors[trigger]);
     }
     passiveBehaviors.Add(trigger, response);
     return(null);
 }
Пример #28
0
        public IObservable<bool> GetActivationForView(IActivatable view)
        {
            var fe = view as Page;

            var ret = Observable.Merge(
                Observable.FromEventPattern<EventHandler, EventArgs>(x => fe.Appearing += x, x => fe.Appearing -= x).Select(_ => true),
                Observable.FromEventPattern<EventHandler, EventArgs>(x => fe.Disappearing += x, x => fe.Disappearing -= x).Select(_ => false));

            return ret.DistinctUntilChanged();
        }
Пример #29
0
        public IObservable <bool> GetActivationForView(IActivatable view)
        {
            var fe = view as Page;

            var ret = Observable.Merge(
                Observable.FromEventPattern <EventHandler, EventArgs>(x => fe.Appearing    += x, x => fe.Appearing -= x).Select(_ => true),
                Observable.FromEventPattern <EventHandler, EventArgs>(x => fe.Disappearing += x, x => fe.Disappearing -= x).Select(_ => false));

            return(ret.DistinctUntilChanged());
        }
Пример #30
0
    public static bool Activate(IActivator activator, IActivatable activatable, Dictionary <object, object> argumentDictionary = null)
    {
        bool capable = (int)activator.GetHealthState() >= (int)HealthState.Capable;

        if (capable && activatable != null)
        {
            activatable.BecomeActivated(activator, argumentDictionary);
        }
        return(capable);
    }
Пример #31
0
        public IObservable <bool> GetActivationForView(IActivatable view)
        {
            var activation =
                GetActivationFor(view as ICanActivate) ??
                GetActivationFor(view as Page) ??
                GetActivationFor(view as View) ??
                GetActivationFor(view as Cell) ??
                Observable <bool> .Never;

            return(activation.DistinctUntilChanged());
        }
Пример #32
0
        private BehaviorSubject <bool> EnsureSubjectFor(IActivatable view)
        {
            BehaviorSubject <bool> subject;

            if (!this.forcedViews.TryGetValue(view, out subject))
            {
                this.forcedViews[view] = subject = new BehaviorSubject <bool>(false);
            }

            return(subject);
        }
Пример #33
0
        /// <summary>
        /// Get an observable defining whether the view is active.
        /// </summary>
        /// <param name="view">The view to observe.</param>
        /// <returns>An observable tracking whether the view is active.</returns>
        public IObservable <bool> GetActivationForView(IActivatable view)
        {
            var canActivate = view as ICanActivate;

            if (canActivate == null)
            {
                return(Observable.Empty(false));
            }

            return(canActivate.Activated.Select(_ => true).Merge(canActivate.Deactivated.Select(_ => false)));
        }
Пример #34
0
        internal GroupReference(String name, IEnumerable<LightAddress> addresses, IActivatable lightProvider)
        {
            if(name == null)
                throw new ArgumentException("Group name cannot be null");
            if(name.Length == 0)
                throw new ArgumentException("Group must have a name. The empty string is not a valid group name");

            _name = name;
            _lightProvider = lightProvider;
            UpdateMembers(addresses);
        }
Пример #35
0
        public bool Check()
        {
            IActivatable element = elementManager.GetActivatableGameElement(refId);

            if (element == null)
            {
                System.Console.WriteLine("There is no activatable element with the given id! " + refId);
                return(false);
            }
            return(element.IsActive() == valueToCheck);
        }
Пример #36
0
 public void ActivateHeldItem()
 {
     if (heldItem != null)
     {
         IActivatable item = heldItem.GetComponentInChildren <IActivatable>();
         if (item != null)
         {
             item.Activate();
         }
     }
 }
Пример #37
0
 protected virtual void SafeFire(int eeiHand, bool MB, bool MBD)
 {
     if (completeBody.GetEquipmentEquipableArray()[eeiHand] != null)
     {
         IActivatable activatable = completeBody.GetEquipmentEquipableArray()[eeiHand] as IActivatable;
         Dictionary <object, object> argumentDictionary = new Dictionary <object, object>();
         argumentDictionary["MB"]  = MB;
         argumentDictionary["MBD"] = MBD;
         Activator.Activate(completeBody, activatable, argumentDictionary);
     }
 }
Пример #38
0
        public IObservable<bool> GetActivationForView(IActivatable view)
        {
            var fe = view as FrameworkElement;

            if (fe == null)
                return Observable.Empty<bool>();

            var viewLoaded = Observable.FromEventPattern<RoutedEventHandler, RoutedEventArgs>(x => fe.Loaded += x,
                x => fe.Loaded -= x).Select(_ => true);

            var viewUnloaded = Observable.FromEventPattern<RoutedEventHandler, RoutedEventArgs>(x => fe.Unloaded += x,
                x => fe.Unloaded -= x).Select(_ => false);

            return viewLoaded
                .Merge(viewUnloaded)
                .Select(b => b ? fe.WhenAnyValue(x => x.IsHitTestVisible).SkipWhile(x => !x) : Observable.Return(false))
                .Switch()
                .DistinctUntilChanged();
        }
Пример #39
0
        public Tuple<IObservable<Unit>, IObservable<Unit>> GetActivationForView(IActivatable view)
        {
            var fe = view as FrameworkElement;

            if (fe == null)
                return Tuple.Create(Observable.Empty<Unit>(), Observable.Empty<Unit>());

            var viewLoaded = Observable.FromEventPattern<RoutedEventHandler, RoutedEventArgs>(x => fe.Loaded += x,
                x => fe.Loaded -= x).Select(_ => Unit.Default);
            var viewHitTestVisible = fe.WhenAnyValue(v => v.IsHitTestVisible);

            var viewActivated = viewLoaded.CombineLatest(viewHitTestVisible, (l, h) => h)
                .Where(v => v)
                .Select(_ => Unit.Default);

            var viewUnloaded = Observable.FromEventPattern<RoutedEventHandler, RoutedEventArgs>(x => fe.Unloaded += x,
                x => fe.Unloaded -= x).Select(_ => Unit.Default);

            return Tuple.Create(viewActivated, viewUnloaded);
        }
Пример #40
0
 public void remove(IActivatable responder)
 {
     list.Remove(responder);
 }
Пример #41
0
 internal MasterGroup(string name, IEnumerable<LightAddress> addresses, IActivatable lightProvider)
 {
     _me = new GroupReference(name, addresses, lightProvider);
 }
Пример #42
0
		public IObservable<bool> GetActivationForView(IActivatable view)
		{
			throw new NotImplementedException();
		}
Пример #43
0
 public IObservable<bool> GetActivationForView(IActivatable view)
 {
     var ca = view as ICanActivate;
     return ca.Activated.Select(_ => true).Merge(ca.Deactivated.Select(_ => false));
 }
 public KinectPatternStart(IActivatable lightProvider, Scene scene, KinectPlugin kinectPlugin, int bodyIndex)
     : base(lightProvider, scene, 0, 0, GetBasePattern(), bodyIndex+1)
 {
     _ordering = GetOrdering(scene, new Vector3D());
     _bodyIndex = bodyIndex;
     _plugin = kinectPlugin;
     _patternGen = new PatternGenerator(scene);
     _patternGen.AvailableOrderings = new List<string>{SpatialOrderingTypes.Expand};
     _patternGen.Params.PatternLengthMin = .5;
     _patternGen.Params.PatternLengthMax = 1;
     _patternGen.Params.ColorsMin = 2;
     kinectPlugin.GestureUpdateHandler += HandleGestureUpdate;
 }
Пример #45
0
 /// <summary>
 /// Adds and activatable item to the activatables list.
 /// </summary>
 /// <param name="tileID">The ID of the tilwe.</param>
 /// <param name="active">The activatable instance.</param>
 public void addActivatable(string tileID, IActivatable active)
 {
     if(!activatables.ContainsKey(tileID))
         activatables.Add(tileID, active);
 }
Пример #46
0
 private static void Deactivate(IActivatable activatable)
 {
     foreach (LEDNode node in activatable.Nodes)
     {
         node.IsActive = false;
     }
     activatable.IsActive = false;
 }
Пример #47
0
 public Tuple<IObservable<Unit>, IObservable<Unit>> GetActivationForView(IActivatable view)
 {
     var ca = view as ICanActivate;
     return Tuple.Create(ca.Activated, ca.Deactivated);
 }
 public ActivatableConductor(IActivatable viewModel)
 {
     this.viewModel = viewModel;
 }
Пример #49
0
 public void TieToControl(IActivatable parent)
 {
     parent.StateChanged += (_, __) => IsOpen = parent.WindowState != WindowState.Minimized;
     parent.Activated += (_, __) => IsOpen = true;
     parent.Deactivated += (_, __) => IsOpen = false;
 }
Пример #50
0
 /**
  * Add a new Activatable to this Activator
  **/
 public void add(IActivatable responder)
 {
     list.Add(responder);
 }
 public static void ActivateForRead(IActivatable tba)
 {
     tba.Activate(ActivationPurpose.Read);
 }
Пример #52
0
 public void Register(IActivatable item)
 {
     _collection.Add(item);
     if (Activated != item.Activated) item.Activated = Activated;
 }