Example #1
0
 private void BootStrapper_BackRequested(object sender, HandledEventArgs e)
 {
     e.Handled = Handled;
     foreach (IAction item in Actions)
     {
         _dispatcher.Run(() => item.Execute(sender, null));
     }
 }
Example #2
0
        public void RaiseForwardRequested(HandledEventArgs args)
        {
            ForwardRequested?.Invoke(this, args);

            if (!args.Handled && this.Frame.ForwardStack.Count > 0)
            {
                GoForward();
            }
        }
        protected override void OnBoundsChangeRequested(Rectangle newBounds, ref bool handled)
        {
            if (BoundsChangeRequested != null)
            {
                HandledEventArgs<Rectangle> e = new HandledEventArgs<Rectangle>(handled, newBounds);
                BoundsChangeRequested(this, e);
                handled = e.Handled;
            }

            base.OnBoundsChangeRequested(newBounds, ref handled);
        }
Example #4
0
        public void RaiseBackRequested(HandledEventArgs args)
        {
            if (BackRequested != null)
            {
                BackRequested.Invoke(this, args);
            }

            if (BackButtonHandling == BootStrapper.BackButton.Attach && !args.Handled && (args.Handled = this.Frame.BackStackDepth > 0))
            {
                GoBack();
            }
        }
Example #5
0
 /// <summary>
 /// Occurs before showing the properties dialog. If the handled member
 /// was set to true, then this class will not show the event args.
 /// </summary>
 /// <param name="e">The event args.</param>
 protected virtual void OnShowProperties(HandledEventArgs e)
 {
     ShowProperties?.Invoke(this, e);
 }
Example #6
0
 public void OnChat(messageBuffer msg, int ply, string text, HandledEventArgs e)
 {
 }
Example #7
0
 public void RaiseForwardRequested(HandledEventArgs args)
 {
     ForwardRequested?.Invoke(this, args);
     // for backwards compat
     FrameFacade.RaiseForwardRequested(args);
 }
        private CommandOutletContent GetHandledContent(string name, CommandOutletColor color, HandledEventArgs args)
        {
            var content = CommandOutletContent.Create(color, name)
                          .Append(CommandOutletColor.DarkGray, "(")
                          .Append(CommandOutletColor.DarkCyan, args.Context.EventId)
                          .Append(CommandOutletColor.DarkGray, ".")
                          .Append(CommandOutletColor.DarkBlue, (args.Context.Index + 1).ToString())
                          .Append(CommandOutletColor.DarkGray, "): ")
                          .Append(CommandOutletColor.DarkYellow, $"[{args.Context.ScheduleId}] ")
                          .Append(CommandOutletColor.DarkCyan, args.Handler.ToString())
                          .Append(CommandOutletColor.DarkGray, "@")
                          .Append(CommandOutletColor.DarkMagenta, args.Context.Trigger.ToString());

            if (!string.IsNullOrWhiteSpace(args.Context.Trigger.Description))
            {
                content.Append(CommandOutletColor.DarkGray, "(" + args.Context.Trigger.Description + ")");
            }

            if (args.Context.Failure.HasValue)
            {
                var failure = args.Context.Failure.Value;

                //为重试信息添加起始标记
                content.Append(CommandOutletColor.Gray, " {");

                if (failure.Count > 0 && failure.Timestamp.HasValue)
                {
                    content.Append(CommandOutletColor.DarkYellow, "#");
                    content.Append(CommandOutletColor.DarkRed, failure.Count.ToString());
                    content.Append(CommandOutletColor.DarkYellow, "#");

                    content.Append(CommandOutletColor.DarkGray, " (");
                    content.Append(CommandOutletColor.DarkRed, failure.Timestamp.HasValue ? failure.Timestamp.ToString() : Properties.Resources.Scheduler_Retry_NoTimestamp);
                    content.Append(CommandOutletColor.DarkGray, ")");
                }

                if (failure.Expiration.HasValue)
                {
                    content.Append(CommandOutletColor.Red, " < ");
                    content.Append(CommandOutletColor.DarkGray, "(");
                    content.Append(CommandOutletColor.DarkMagenta, failure.Expiration.HasValue ? failure.Expiration.ToString() : Properties.Resources.Scheduler_Retry_NoExpiration);
                    content.Append(CommandOutletColor.DarkGray, ")");
                }

                //为重试信息添加结束标记
                content.Append(CommandOutletColor.Gray, "}");
            }

            if (args.Exception != null)
            {
                //设置名称内容端的文本颜色为红色
                content.First.Color = CommandOutletColor.Red;

                content.AppendLine()
                .Append(this.GetExceptionContent(args.Exception));
            }

            return(content);
        }
Example #9
0
 private void OnGreetPlayer(int who, HandledEventArgs e)
 {
     if (Main.netMode != 2)
     {
         return;
     }
     int plr = who; //legacy support
     Log.Info(Tools.FindPlayer(who) + " (" + Tools.GetPlayerIP(who) + ") from '" + players[who].group.GetName() + "' group joined.");
     Tools.ShowMOTD(who);
     if (HackedHealth(who))
     {
         Tools.HandleCheater(who, "Hacked health.");
     }
     if (ConfigurationManager.permaPvp)
     {
         Main.player[who].hostile = true;
         NetMessage.SendData(30, -1, -1, "", who);
     }
     if (players[who].group.HasPermission("causeevents") && ConfigurationManager.infiniteInvasion)
     {
         StartInvasion();
     }
     ShowUpdateReminder(who);
     e.Handled = true;
 }
Example #10
0
 /// <summary>
 /// Move the active window to the next screen
 /// </summary>
 private void NextScreenHotkey_Pressed(object sender, HandledEventArgs e)
 {
     e.Handled = MoveActiveWindowToScreen(+1);
 }
        private static void OnTileStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var source = d as TileViewItem;
            if ((source != null) && !source.TileStateRevertedFlag)
            {
                var args = new HandledEventArgs();                
                source.OnPreviewTileStateChanged(args);
                if (args.Handled)
                {
                    try
                    {
                        source.TileStateRevertedFlag = true;
                        source.TileState = (TileViewItemState) e.OldValue;
                        if (((TileViewItemState) e.NewValue) == TileViewItemState.Maximized)
                        {
                            source.HandleMaximizedReverted();
                        }
                    }
                    finally
                    {
                        source.TileStateRevertedFlag = false;
                    }
                }
                else
                {
                    switch (((TileViewItemState) e.NewValue))
                    {
                        case TileViewItemState.Restored:
                            source.HandleItemRestored();
                            break;

                        case TileViewItemState.Maximized:
                            source.HandleItemMaximized();
                            break;

                        case TileViewItemState.Minimized:
                            source.HandleItemMinimized();
                            break;
                    }
                    source.OnTileStateChanged(new HandledEventArgs());
                }
            }
        }
Example #12
0
        private void OnForwardRequested()
        {
            var args = new HandledEventArgs();
            ForwardRequested?.Invoke(this, args);

            if (!args.Handled)
            {
                NavigationService.GoForward();
                args.Handled = true;
            }
        }
Example #13
0
        /// <summary>
        /// When a server command is run.
        /// </summary>
        /// <param name="cmd"></param>
        /// <param name="e"></param>
        private void ServerHooks_OnCommand(string text, HandledEventArgs e)
        {
            // Damn you ThreadStatic and Redigit
            if (Main.rand == null)
            {
                Main.rand = new Random();
            }
            if (WorldGen.genRand == null)
            {
                WorldGen.genRand = new Random();
            }

            if (text.StartsWith("exit"))
            {
                Tools.ForceKickAll("Server shutting down!");
            }
            else if (text.StartsWith("playing") || text.StartsWith("/playing"))
            {
                int count = 0;
                foreach (TSPlayer player in Players)
                {
                    if (player != null && player.Active)
                    {
                        count++;
                        TSPlayer.Server.SendMessage(string.Format("{0} ({1}) [{2}]", player.Name, player.IP, player.Group.Name));
                    }
                }
                TSPlayer.Server.SendMessage(string.Format("{0} players connected.", count));
                e.Handled = true;
            }
            else if (text.StartsWith("say "))
            {
                Log.Info(string.Format("Server said: {0}", text.Remove(0, 4)));
            }
            else if (text.StartsWith("/"))
            {
                if (Commands.HandleCommand(TSPlayer.Server, text))
                    e.Handled = true;
            }
        }
 protected internal virtual void OnPreviewTileStateChanged(HandledEventArgs e)
 {
     var evt = PreviewTileStateChanged;
     if (evt != null)
         evt(this, e);
 }
Example #15
0
        private void OnJoin(int ply, HandledEventArgs handler)
        {
            if (Main.netMode != 2 || handler.Handled)
                return;

            var player = new TSPlayer(ply);
            player.Group = Tools.GetGroupForIP(player.IP);

            if (Tools.ActivePlayers() + 1 > ConfigurationManager.MaxSlots && !player.Group.HasPermission("reservedslot"))
            {
                Tools.ForceKick(player, "Server is full");
                handler.Handled = true;
            }
            else
            {
                var ban = Bans.GetBanByIp(player.IP);
                if (ban != null)
                {
                    Tools.ForceKick(player, string.Format("You are banned: {0}", ban.Reason));
                    handler.Handled = true;
                }
                else if (!FileTools.OnWhitelist(player.IP))
                {
                    Tools.ForceKick(player, "Not on whitelist.");
                    handler.Handled = true;
                }
            }

            Players[ply] = player;
            Netplay.serverSock[ply].spamCheck = ConfigurationManager.SpamChecks;
        }
Example #16
0
        private void OnGreetPlayer(int who, HandledEventArgs e)
        {
            if (Main.netMode != 2)
                return;

            TSPlayer player = Players[who];
            Log.Info(string.Format("{0} ({1}) from '{2}' group joined.", player.Name, player.IP, player.Group.Name));

            Tools.ShowFileToUser(player, "motd.txt");
            if (HackedHealth(player))
            {
                Tools.HandleCheater(player, "Hacked health.");
            }
            if (ConfigurationManager.PermaPvp)
            {
                player.SetPvP(true);
            }
            if (Players[who].Group.HasPermission("causeevents") && ConfigurationManager.InfiniteInvasion)
            {
                StartInvasion();
            }
            e.Handled = true;
        }
Example #17
0
        private void OnChat(messageBuffer msg, int ply, string text, HandledEventArgs e)
        {
            if (Main.netMode != 2)
                return;

            if (msg.whoAmI != ply)
            {
                e.Handled = Tools.HandleGriefer(Players[ply], "Faking Chat");
                return;
            }

            var tsplr = Players[msg.whoAmI];

            if (tsplr.Group.HasPermission("adminchat") && !text.StartsWith("/"))
            {
                Tools.Broadcast(ConfigurationManager.AdminChatPrefix + "<" + tsplr.Name + "> " + text,
                                (byte)ConfigurationManager.AdminChatRGB[0], (byte)ConfigurationManager.AdminChatRGB[1], (byte)ConfigurationManager.AdminChatRGB[2]);
                e.Handled = true;
                return;
            }

            if (text.StartsWith("/"))
            {
                if (Commands.HandleCommand(tsplr, text))
                    e.Handled = true;
            }
            else
            {
                Log.Info(string.Format("{0} said: {1}", tsplr.Name, text));
            }
        }
Example #18
0
        /// <summary>
        /// Default Hardware/Shell Back handler overrides standard Back behavior that navigates to previous app
        /// in the app stack to instead cause a backward page navigation.
        /// Views or Viewodels can override this behavior by handling the BackRequested event and setting the
        /// Handled property of the BackRequestedEventArgs to true.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RaiseBackRequested()
        {
            var args = new HandledEventArgs();
            BackRequested?.Invoke(this, args);

            if (!args.Handled)
            {
                NavigationService.GoBack();
                args.Handled = true;
            }
        }
Example #19
0
 protected virtual void OnBackRequestedOverride(object sender, HandledEventArgs e)
 {
     e.Handled = true;
     Hide(ContentDialogBaseResult.None);
 }
Example #20
0
 internal void RaiseForwardRequested(HandledEventArgs args) => ForwardRequested?.Invoke(this, args);
Example #21
0
        /// <summary>
        /// The hotkey was pressed! Handle it
        /// </summary>
        private void UserHotkey_Pressed(object sender, HandledEventArgs e)
        {
            PlaceCall PC = new PlaceCall();

            PC.f_placeCall(ProcessIcon.NotifyIcon);
        }
Example #22
0
 void OnGreetPlayer(int who, HandledEventArgs e)
 {
     try
     {
         if (Main.netMode != 2) { return; }
         int plr = who; //legacy support
         Tools.ShowMOTD(who);
         if (Main.player[plr].statLifeMax > 400 || Main.player[plr].statManaMax > 200 || Main.player[plr].statLife > 400 || Main.player[plr].statMana > 200 || CheckInventory(plr))
         {
             Tools.HandleCheater(plr);
         }
         if (ConfigurationManager.permaPvp)
         {
             Main.player[who].hostile = true;
             NetMessage.SendData(30, -1, -1, "", who);
         }
         if (TShock.players[who].IsAdmin() && ConfigurationManager.infiniteInvasion && !ConfigurationManager.startedInvasion)
         {
             StartInvasion();
         }
         ShowUpdateReminder(who);
         e.Handled = true;
     }
     catch (Exception ex)
     {
         FileTools.WriteError(ex.ToString());
     }
 }
Example #23
0
 private void Hk_stop_Pressed(object sender, HandledEventArgs e)
 {
     this.timer1.Stop();
 }
Example #24
0
        private void OnChat(messageBuffer msg, int ply, string text, HandledEventArgs e)
        {
            if (Main.netMode != 2)
                return;

            if (msg.whoAmI != ply)
            {
                e.Handled = Tools.HandleGriefer(ply, "Faking Chat");
                return;
            }

            int x = (int)Main.player[ply].position.X;
            int y = (int)Main.player[ply].position.Y;

            if (text.StartsWith("/"))
            {
                //Commands.CommandArgs args = new Commands.CommandArgs(msg, x, y, ply);
                Commands.Command cmd = null;
                for (int i = 0; i < Commands.commands.Count; i++)
                {
                    if (Commands.commands[i].Name().Equals(text.Split(' ')[0].TrimStart('/')))
                    {
                        cmd = Commands.commands[i];
                    }
                }

                if (cmd == null)
                {
                    Tools.SendMessage(ply, "That command does not exist, try /help", new float[] { 255, 0, 0 });
                }
                else
                {
                    if (!cmd.Run(text, players[ply]))
                    {
                        Log.Info(Tools.FindPlayer(ply) + " tried to execute " + cmd.Name() +
                                 " that s/he did not have access to!");
                        Tools.SendMessage(ply, "You do not have access to that command.", new float[] { 255, 0, 0 });
                    }
                }
                e.Handled = true;
            }
        }
Example #25
0
 private void Hk_start_Pressed(object sender, HandledEventArgs e)
 {
     timer1.Enabled = true;
     this.timer1.Start();
     this.timer1.Interval = int.Parse((string.IsNullOrEmpty(this.textBox4.Text)) ? "0.77" : this.textBox4.Text);
 }
Example #26
0
 /// <summary>
 /// Make the active window less transparent
 /// </summary>
 private void LessTransparentHotkey_Pressed(object sender, HandledEventArgs e)
 {
     e.Handled = ChangeAlpha(GetForegroundWindow(), +16);
 }
 private void AllowOpenDetailViewController_CustomHandleProcessSelectedItem(object sender, HandledEventArgs e)
 {
     e.Handled = (this.View.Model as IModelAllowOpenDetailView).AllowOpenDetailView == false;
 }
Example #28
0
 public virtual void OnDoubleClick(HandledEventArgs e)
 {
 }
Example #29
0
 /// <summary>
 /// Occurs when this member should raise the shared event to show the property dialog for this raster layer.
 /// </summary>
 /// <param name="e">The event args.</param>
 protected override void OnShowProperties(HandledEventArgs e)
 {
     var rla = RasterLayerActions;
     rla?.ShowProperties(this);
     e.Handled = true;
 }
Example #30
0
 private void buttonRemoveContact_Click(object sender, HandledEventArgs e)
 {
     buttonRemoveContact_Click(sender, (EventArgs)e);
 }
Example #31
0
 public void RaiseForwardRequested(HandledEventArgs args)
 {
     ForwardRequested?.Invoke(this, args);
 }
Example #32
0
 public void OnGreetPlayer(int who, HandledEventArgs e)
 {
 }
Example #33
0
 private void Hk_Win_C_OnPressed(object sender, HandledEventArgs handledEventArgs)
 {
     StartSnipping();
 }
Example #34
0
 void SpreadsheetControl_ProtectionWarning(object sender, HandledEventArgs e)
 {
     e.Handled = true;
 }
Example #35
0
        private void OnJoin(int ply, HandledEventArgs handler)
        {
            if (Main.netMode != 2)
            {
                return;
            }

            string ip = Tools.GetPlayerIP(ply);
            players[ply] = new TSPlayer(ply);
            players[ply].group = Tools.GetGroupForIP(ip);

            if (Tools.activePlayers() + 1 > ConfigurationManager.maxSlots &&
                !players[ply].group.HasPermission("reservedslot"))
            {
                Tools.ForceKick(ply, "Server is full");
                handler.Handled = true;
            }
            else
            {
                var ban = Bans.GetBanByIp(ip);
                if (ban != null)
                {
                    Tools.ForceKick(ply, "You are banned: " + ban.Reason);
                    handler.Handled = true;
                }
                else if (!FileTools.OnWhitelist(ip))
                {
                    Tools.ForceKick(ply, "Not on whitelist.");
                    handler.Handled = true;
                }
            }
        }
Example #36
0
 public void RaiseBackRequested(HandledEventArgs args)
 {
     BackRequested?.Invoke(this, args);
 }
Example #37
0
 private void BackButtonService_NavigateBack(object sender, HandledEventArgs e)
 {
     e.Handled = Handled;
     Interaction.ExecuteActions(AssociatedObject, Actions, null);
 }
Example #38
0
 private void OnStartClicked(HandledEventArgs args)
 {
     args.Handled = true;
     _mapController.NextTurn();
 }
Example #39
0
 private void BootStrapper_BackRequested(object sender, HandledEventArgs e)
 {
     e.Handled = Handled;
     Interaction.ExecuteActions(AssociatedObject, Actions, null);
 }
Example #40
0
 internal void RaiseBackRequested(HandledEventArgs args) => BackRequested?.Invoke(this, args);
Example #41
0
        private void HotkeyPressed_Handler(object sender, HandledEventArgs e)
        {
            this.ThumbnailActivated?.Invoke(this.Id);

            e.Handled = true;
        }
Example #42
0
 public void OnBackRequested(HandledEventArgs args)
 {
     View.OnBackRequested(args);
 }
Example #43
0
 /// <summary>
 /// Raises the <see cref="Interrupt"/> event.
 /// </summary>
 /// <param name="e">A <see cref="HandledEventArgs"/> that contains the event data.</param>
 protected virtual void OnInterrupt(HandledEventArgs e)
 {
     Interrupt?.Invoke(this, e);
 }
Example #44
0
        void OnChat(int ply, string msg, HandledEventArgs handler)
        {
            try
            {
                if (Main.netMode != 2) { return; }
                int x = (int)Main.player[ply].position.X;
                int y = (int)Main.player[ply].position.Y;

                if (msg.StartsWith("/"))
                {
                    Commands.CommandArgs args = new Commands.CommandArgs(msg, x, y, ply);
                    var commands = commandList;
                    if (TShock.players[ply].IsAdmin())
                        commands = admincommandList;

                    Commands.CommandDelegate command;
                    if (commands.TryGetValue(msg.Split(' ')[0].TrimStart('/'), out command))
                    {
                        Log.Info(Tools.FindPlayer(ply) + " executed " + msg);
                        command.Invoke(args);
                    }
                    else
                    {
                        Log.Info(Tools.FindPlayer(ply) + " tried to execute " + msg);
                        Tools.SendMessage(ply, "Invalid command or no permissions! Try /help.", new float[] { 255f, 0f, 0f });
                    }
                    handler.Handled = true;
                }
            }
            catch (Exception ex)
            {
                FileTools.WriteError(ex.ToString());
            }
        }
Example #45
0
 private void ServerHooks_SendBytes(ServerSock socket, byte[] buffer, int offset, int count, HandledEventArgs e)
 {
     e.Handled = true;
     BufferBytes(socket, buffer, offset, count);
 }
Example #46
0
 void ServerHooks_OnCommand(string cmd, HandledEventArgs e)
 {
 }
        protected override void OnBackRequestedOverride(object sender, HandledEventArgs e)
        {
            //var container = GetContainer(0);
            //var root = container.Presenter;
            if (_closing != null)
            {
                Presenter.Opacity = 0;
                Preview.Opacity   = 1;

                var root = Preview.Presenter;

                var animation = ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("FullScreenPicture", root);
                if (animation != null)
                {
                    if (ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Media.Animation.ConnectedAnimation", "Configuration"))
                    {
                        animation.Configuration = new BasicConnectedAnimationConfiguration();
                    }

                    var element = _closing();
                    if (element.ActualWidth > 0 && animation.TryStart(element))
                    {
                        animation.Completed += (s, args) =>
                        {
                            Hide();
                        };
                    }
                    else
                    {
                        Hide();
                    }
                }
                else
                {
                    Hide();
                }
            }
            else
            {
                //var batch = _layout.Compositor.CreateScopedBatch(CompositionBatchTypes.Animation);

                //_layout.StartAnimation("Offset.Y", CreateScalarAnimation(_layout.Offset.Y, (float)ActualHeight));

                //batch.End();
                //batch.Completed += (s, args) =>
                //{
                //    ScrollingHost.Opacity = 0;
                //    Preview.Opacity = 1;

                //    Hide();
                //};
            }

            //_layer.StartAnimation("Opacity", CreateScalarAnimation(1, 0));

            //if (Transport.IsVisible)
            //{
            //    Transport.Hide();
            //}

            //Unload();
            //Dispose();

            e.Handled = true;
        }
 private void TileViewPreviewTileStateChanged(object sender, HandledEventArgs e)
 {
     var source = sender as TileViewItem;
     var control = ItemsControlFromItemContainer(source);
     if (((source != null) && (control != null)) &&
         ((Equals(this, control)) && (source.TileState == TileViewItemState.Maximized)))
     {
         e.Handled = MaximizeMode == TileViewMaximizeMode.Zero;
     }
 }
Example #49
0
        /// <summary>
        /// The hotkey was pressed! Handle it
        /// </summary>
        private void UserHotkey_Pressed(object sender, HandledEventArgs e)
        {
            IntPtr activeWindowHandle = GetForegroundWindow();

            if (activeWindowHandle != IntPtr.Zero)
            {
                if (activeWindowHandle == GetShellWindow())
                {
                    this.notifyIcon.ShowBalloonTip(3000, "See Through Windows", "Cannot make desktop transparent", ToolTipIcon.Warning);
                    return;
                }

                // Do we know this window?
                WindowInfo window = null;
                if (this.hijackedWindows.ContainsKey(activeWindowHandle))
                {
                    window = this.hijackedWindows[activeWindowHandle];
                }
                else
                {
                    window = HijackWindow(activeWindowHandle);
                }

                short newAlpha = window.CurrentAlpha;

                // Toggle the alpha value betwee OPAQUE and semitransparent
                if (newAlpha == OPAQUE)
                {
                    newAlpha = this.semiTransparentValue;
                }
                else
                {
                    newAlpha = OPAQUE;
                }

                if (!SetLayeredWindowAttributes(activeWindowHandle, 0, newAlpha, LWA_ALPHA))
                {
                    this.notifyIcon.ShowBalloonTip(3000, "See Through Windows", "Could not set transparency on this window", ToolTipIcon.Error);
                }
                else
                {
                    window.CurrentAlpha = newAlpha;

                    // Also make window topmost if specified
                    if (this.clickThroughCheckBox.Checked && this.topMostCheckBox.Checked)
                    {
                        SetWindowPos(activeWindowHandle, new IntPtr(HWND_TOPMOST), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
                    }
                }

                // If the window is not transparent anymore, we're not interested anymore
                if (newAlpha == OPAQUE)
                {
                    // Restore the old window style
                    RestoreStyle(activeWindowHandle, window.Style);
                    // Let go of the window info
                    this.hijackedWindows.Remove(activeWindowHandle);
                }

                e.Handled = true;
            }
        }