Esempio n. 1
0
        /// <summary>
        /// The programmed timeout elapsed and we shall execute what ever we need to
        /// </summary>
        /// <param name="c">The reference to the ICallout executing</param>
        /// <param name="serverConnection">Connection to the Server</param>
        /// <returns></returns>
        public bool CalloutCallback(ICallout c, IServerConnection serverConnection)
        {
            TimesCalled++;

            switch (TimesCalled)
            {
            case 1:
                targetPlayer.Message("Toc...");
                break;

            case 2:
                targetPlayer.Message("Toc... Toc...");
                break;

            default:
                targetPlayer.Error("GOT YOU! YOU WILL DIE HAHAHAHAHHAHA!");
                break;
            }

            if (TimesCalled < 3)
            {
                // As long we have not been called 3 Times, we tell the CalloutManager to repeat the callout
                return(true);
            }
            else
            {
                // We are done now, so we tell the manager to no longer call us
                return(false);
            }
        }
 private bool method_2(IElement ielement_1, out ICallout icallout_0)
 {
     icallout_0 = null;
     try
     {
         if (ielement_1 is ITextElement)
         {
             ITextElement element = ielement_1 as ITextElement;
             ITextSymbol  symbol  = element.Symbol;
             if (!(symbol is IFormattedTextSymbol))
             {
                 return(false);
             }
             IFormattedTextSymbol symbol2    = symbol as IFormattedTextSymbol;
             ITextBackground      background = symbol2.Background;
             if (background == null)
             {
                 return(false);
             }
             if (!(background is ICallout))
             {
                 return(false);
             }
             icallout_0 = background as ICallout;
             return(true);
         }
         if (ielement_1 is IMarkerElement)
         {
             IMarkerElement element2 = ielement_1 as IMarkerElement;
             IMarkerSymbol  symbol3  = element2.Symbol;
             if (!(symbol3 is IMarkerBackgroundSupport))
             {
                 return(false);
             }
             IMarkerBackgroundSupport support     = symbol3 as IMarkerBackgroundSupport;
             IMarkerBackground        background2 = support.Background;
             if (background2 == null)
             {
                 return(false);
             }
             if (!(background2 is ICallout))
             {
                 return(false);
             }
             icallout_0 = background2 as ICallout;
             return(true);
         }
     }
     catch
     {
     }
     return(false);
 }
Esempio n. 3
0
        public void Register(ICallout callout)
        {
            Argument.IsNotNull(() => callout);

            Log.Debug($"Registering callout '{callout}'");

            _callouts.Add(callout);

            SubscribeToCallout(callout);

            Registered?.Invoke(this, new CalloutEventArgs(callout));
        }
Esempio n. 4
0
        public void Unregister(ICallout callout)
        {
            Argument.IsNotNull(() => callout);

            Log.Debug($"Unregistering callout '{callout}'");

            UnsubscribeFromCallout(callout);

            // Make sure to hide
            callout.Hide();

            _callouts.Remove(callout);

            Unregistered?.Invoke(this, new CalloutEventArgs(callout));
        }
Esempio n. 5
0
        public bool CalloutCallback(ICallout c, IServerConnection serverConnection)
        {
            // lets have some fun and pester some random player
            var onlinePlayers = (from player in serverConnection.AllPlayers.Players where player.IsOnline select player).ToArray();

            if ((onlinePlayers != null) && (onlinePlayers.Length > 0))
            {
                var rnd = new Random();

                var victim = onlinePlayers[rnd.Next(onlinePlayers.Length)];

                serverConnection.CalloutManager.AddCallout(myExtension.Instance, new Example2EffectCallout(victim), TimeSpan.FromSeconds(10), false);
            }

            // return value is ignored since this is a persistent callout. See Example2RemoveCalloutCommand on how to remove it
            return(false);
        }
Esempio n. 6
0
 public bool CalloutCallback(ICallout c, IServerConnection serverConnection)
 {
     if (RestockAmount <= 0)
     {
         return(false);
     }
     if (StockAmount < MaxStock)
     {
         StockAmount           += RestockAmount;
         StockAmount            = Math.Min(MaxStock, StockAmount);
         Program.Config.IsDirty = true;
         logger.Info("{0} restocking {1} new Stock {2}", Shop.ShopName, ItemName, StockAmount);
     }
     else
     {
         logger.Debug("{0} restocking {1}: max stock reached", Shop.ShopName, ItemName, StockAmount);
     }
     return(true);
 }
 private void ElementSizeAndPositionCtrl_Load(object sender, EventArgs e)
 {
     try
     {
         IEnvelope outEnvelope = new EnvelopeClass();
         this.ielement_0.Geometry.QueryEnvelope(outEnvelope);
         ICallout callout = null;
         this.method_2(this.ielement_0, out callout);
         if (callout != null)
         {
             this.txtX.Text = callout.AnchorPoint.X.ToString("0.###");
             this.txtY.Text = callout.AnchorPoint.Y.ToString("0.###");
         }
         else
         {
             this.txtX.Text = outEnvelope.XMin.ToString("0.###");
             this.txtY.Text = outEnvelope.YMin.ToString("0.###");
         }
         this.txtWidth.Text  = outEnvelope.Width.ToString("0.###");
         this.txtHeight.Text = outEnvelope.Height.ToString("0.###");
         if (this.ielement_0 is ILineElement)
         {
             IPointCollection geometry = this.ielement_0.Geometry as IPointCollection;
             if (geometry.PointCount == 2)
             {
                 IPoint point  = geometry.get_Point(0);
                 IPoint point2 = geometry.get_Point(1);
                 if (point.Y == point2.Y)
                 {
                     this.txtHeight.Enabled = false;
                 }
                 if (point.X == point2.X)
                 {
                     this.txtWidth.Enabled = false;
                 }
             }
         }
     }
     catch
     {
     }
     this.bool_0 = true;
 }
        private void ElementSizeAndPositionCtrl_Load(object sender, EventArgs e)
        {
            IEnvelope outEnvelope = new EnvelopeClass();

            this.ielement_0.Geometry.QueryEnvelope(outEnvelope);
            ICallout callout = null;

            this.method_1(this.ielement_0, out callout);
            if (callout != null)
            {
                this.txtX.Text = callout.AnchorPoint.X.ToString("0.###");
                this.txtY.Text = callout.AnchorPoint.Y.ToString("0.###");
            }
            else
            {
                this.txtX.Text = outEnvelope.XMin.ToString("0.###");
                this.txtY.Text = outEnvelope.YMin.ToString("0.###");
            }
            this.txtWidth.Text  = outEnvelope.Width.ToString("0.###");
            this.txtHeight.Text = outEnvelope.Height.ToString("0.###");
        }
Esempio n. 9
0
 public void RemoveCallout(ICallout callout)
 {
     CalloutManagerImpl.AllCallouts.Remove(callout);
     UpdateCallouts();
 }
Esempio n. 10
0
 public static void RegisterCallout(ICallout callout)
 {
     AllCallouts.Add(callout);
     UpdateCallouts();
 }
Esempio n. 11
0
        public static string GetCalloutConfigurationKeyPrefix(this ICallout callout)
        {
            Argument.IsNotNull(() => callout);

            return(GetCalloutConfigurationKeyPrefix(callout.Name, callout.Version));
        }
Esempio n. 12
0
 public void CalloutCallback(ICallout c)
 {
     
 }
        public static bool IsCalloutMarkedAsShown(this IConfigurationService configurationService, ICallout callout)
        {
            Argument.IsNotNull(() => configurationService);
            Argument.IsNotNull(() => callout);

            var configurationKey = $"{callout.GetCalloutConfigurationKeyPrefix()}.Shown";

            return(configurationService.GetRoamingValue(configurationKey, false));
        }
        public static void MarkCalloutAsShown(this IConfigurationService configurationService, ICallout callout)
        {
            Argument.IsNotNull(() => configurationService);
            Argument.IsNotNull(() => callout);

            var configurationKey = $"{callout.GetCalloutConfigurationKeyPrefix()}.Shown";

            configurationService.SetRoamingValue(configurationKey, true);

            configurationService.SetCalloutLastShown(callout, DateTime.UtcNow);
        }
        public static void MarkCalloutAsNotShown(this IConfigurationService configurationService, ICallout callout)
        {
            Argument.IsNotNull(() => configurationService);
            Argument.IsNotNull(() => callout);

            var configurationKey = $"{callout.GetCalloutConfigurationKeyPrefix()}.Shown";

            configurationService.SetRoamingValue(configurationKey, false);
        }
        public static DateTime?GetCalloutLastShown(this IConfigurationService configurationService, ICallout callout)
        {
            Argument.IsNotNull(() => configurationService);
            Argument.IsNotNull(() => callout);

            var configurationKey = $"{callout.GetCalloutConfigurationKeyPrefix()}.LastShown";

            return(configurationService.GetRoamingValue <DateTime?>(configurationKey, null));
        }
 public MainPage()
 {
     this.InitializeComponent();
     this.callout = SimpleIoc.Default.GetInstance<ICallout>();
 }
 public ICalloutObject(ICallout ICalloutinstance)
 {
     ICalloutInstance = ICalloutinstance;
 }
Esempio n. 19
0
 public bool CalloutCallback(ICallout c, IServerConnection serverConnection)
 {
     serverConnection.Execute(Command);
     return(false);
 }
Esempio n. 20
0
        public CalloutEventArgs(ICallout callout)
        {
            Argument.IsNotNull(() => callout);

            Callout = callout;
        }
Esempio n. 21
0
        //public void ShowAllCallouts()
        //{
        //    foreach (var callout in Callouts)
        //    {
        //        if (callout is Controls.CalloutViewModel vm)
        //        {
        //            if (vm.Delay is not null && vm.Delay > 0)
        //            {
        //                var timer = new DispatcherTimer();
        //                timer.Interval = TimeSpan.FromSeconds((int)vm.Delay);
        //                timer.Tick += (object o, EventArgs e) =>
        //                {
        //                    vm.IsOpen = true;
        //                    timer.Stop();
        //                };
        //                timer.Start();
        //            }
        //            else
        //            {
        //                vm.IsOpen = true;
        //            }
        //        }
        //    }
        //}

        //public void ShowCallout(UIElement element)
        //{
        //    foreach (var callout in Callouts)
        //    {
        //        if (callout is CalloutViewModel vm)
        //        {
        //            if (vm.PlacementTarget == element)
        //            {
        //                vm.IsOpen = true;
        //            }
        //        }
        //    }
        //}

        private void SubscribeToCallout(ICallout callout)
        {
            callout.Showing += OnCalloutShowing;
            callout.Hiding  += OnCalloutHiding;
        }
Esempio n. 22
0
 private void UnsubscribeFromCallout(ICallout callout)
 {
     callout.Showing -= OnCalloutShowing;
     callout.Hiding  -= OnCalloutHiding;
 }
 public MainPage()
 {
     this.InitializeComponent();
     this.callout = SimpleIoc.Default.GetInstance <ICallout>();
 }
        public static void SetCalloutLastShown(this IConfigurationService configurationService, ICallout callout)
        {
            Argument.IsNotNull(() => configurationService);
            Argument.IsNotNull(() => callout);

            SetCalloutLastShown(configurationService, callout, DateTime.UtcNow);
        }
        public static void SetCalloutLastShown(this IConfigurationService configurationService, ICallout callout, DateTime?lastShown)
        {
            Argument.IsNotNull(() => configurationService);
            Argument.IsNotNull(() => callout);

            var configurationKey = $"{callout.GetCalloutConfigurationKeyPrefix()}.LastShown";

            configurationService.SetRoamingValue(configurationKey, lastShown);
        }
Esempio n. 26
0
 public bool CalloutCallback(ICallout c, IServerConnection serverConnection)
 {
     serverConnection.Execute("llp");
     return(true);
 }