Inheritance: System.EventArgs
 public static bool OnStartHardMode()
 {
     if (StartHardMode == null)
         return false;
     HandledEventArgs handledEventArgs = new HandledEventArgs();
     WorldHooks.StartHardMode(handledEventArgs);
     return handledEventArgs.Handled;
 }
 private void OnCanClose(object sender, HandledEventArgs handledEventArgs){
     if (!handledEventArgs.Handled){
         bool handled = Frame.Context == TemplateContext.ApplicationWindow &&((IModelOptionsMinimizeOnCloseOptions) Application.Model.Options).MinimizeOnClose;
         handledEventArgs.Handled = handled;
         if (handled)
             _closeWindowController.FormClosing += CloseWindowControllerOnFormClosing;
     }
 }
 public static bool OnSmashAltar()
 {
     if (SmashAltar == null)
         return false;
     HandledEventArgs handledEventArgs = new HandledEventArgs();
     WorldHooks.SmashAltar(handledEventArgs);
     return handledEventArgs.Handled;
 }
Beispiel #4
0
 public static bool OnDrawInterface(SpriteBatch batch)
 {
     if (DrawInterface == null)
         return false;
     var args = new HandledEventArgs();
     DrawInterface(batch, args);
     return args.Handled;
 }
Beispiel #5
0
        public static bool OnGetKeyState()
        {
            if (GetKeyState == null)
                return false;

            var args = new HandledEventArgs();
            GetKeyState(args);
            return args.Handled;
        }
Beispiel #6
0
        public static bool OnCommand(string cmd)
        {
            if (Command == null)
                return false;

            var args = new HandledEventArgs();
            Command(cmd, args);
            return args.Handled;
        }
Beispiel #7
0
        public static bool OnSaveWorld(bool resettime)
        {
            if (SaveWorld == null)
                return false;

            var args = new HandledEventArgs();
            SaveWorld(resettime, args);
            return args.Handled;
        }
Beispiel #8
0
        public static bool OnJoin(int whoami)
        {
            if (Join == null)
                return false;

            var args = new HandledEventArgs();
            Join(whoami, args);
            return args.Handled;
        }
Beispiel #9
0
        public static bool OnChat(messageBuffer msg, int whoami, string text)
        {
            if (Chat == null)
                return false;

            var args = new HandledEventArgs();
            Chat(msg, whoami, text, args);
            return args.Handled;
        }
 public static bool OnSaveWorld(bool resettime)
 {
     if (WorldHooks.SaveWorld == null)
     {
         return false;
     }
     HandledEventArgs handledEventArgs = new HandledEventArgs();
     WorldHooks.SaveWorld(resettime, handledEventArgs);
     return handledEventArgs.Handled;
 }
Beispiel #11
0
 public static bool OnJoin(int whoami)
 {
     if (ServerHooks.Join == null)
     {
         return false;
     }
     HandledEventArgs handledEventArgs = new HandledEventArgs();
     ServerHooks.Join(whoami, handledEventArgs);
     return handledEventArgs.Handled;
 }
 public static bool OnChat(ref string msg)
 {
     if (ClientHooks.Chat != null)
     {
         HandledEventArgs handledEventArgs = new HandledEventArgs();
         ClientHooks.Chat(ref msg, handledEventArgs);
         return handledEventArgs.Handled;
     }
     return false;
 }
Beispiel #13
0
 public static bool OnSendBytes(ServerSock socket, byte[] buffer, int offset, int count)
 {
     if (NetHooks.SendBytes == null)
     {
         return false;
     }
     HandledEventArgs handledEventArgs = new HandledEventArgs();
     NetHooks.SendBytes(socket, buffer, offset, count, handledEventArgs);
     return handledEventArgs.Handled;
 }
Beispiel #14
0
 public static bool OnCommand(string cmd)
 {
     if (ServerHooks.Command == null)
     {
         return false;
     }
     HandledEventArgs handledEventArgs = new HandledEventArgs();
     ServerHooks.Command(cmd, handledEventArgs);
     return handledEventArgs.Handled;
 }
Beispiel #15
0
 public static bool OnChat(messageBuffer msg, int whoami, string text)
 {
     if (ServerHooks.Chat == null)
     {
         return false;
     }
     HandledEventArgs handledEventArgs = new HandledEventArgs();
     ServerHooks.Chat(msg, whoami, text, handledEventArgs);
     return handledEventArgs.Handled;
 }
Beispiel #16
0
 public static bool OnGreetPlayer(int who)
 {
     if (NetHooks.GreetPlayer == null)
     {
         return false;
     }
     HandledEventArgs handledEventArgs = new HandledEventArgs();
     NetHooks.GreetPlayer(who, handledEventArgs);
     return handledEventArgs.Handled;
 }
Beispiel #17
0
 public static bool OnGetKeyState()
 {
     if (GameHooks.GetKeyState == null)
     {
         return false;
     }
     HandledEventArgs handledEventArgs = new HandledEventArgs();
     GameHooks.GetKeyState(handledEventArgs);
     return handledEventArgs.Handled;
 }
Beispiel #18
0
        public static bool OnChat(ref string msg)
        {
            if (Chat != null)
            {
                HandledEventArgs args = new HandledEventArgs();
                Chat(ref msg, args);
                return args.Handled;
            }

            return false;
        }
Beispiel #19
0
 void OnCustomWriteSecuredLogonParameters(object sender, HandledEventArgs handledEventArgs) {
     var webApplication = ((WebApplication) sender);
     handledEventArgs.Handled = true;
     if (HttpContext.Current == null) {
         Tracing.Tracer.LogWarning("Cannot add a Forms cookie to the Respose.Cookies collection: the HttpContext.Current property is null");
         return;
     }
     var logonParametersAsString = LogonParametersAsString();
     var cookie = HttpCookie(logonParametersAsString, webApplication);
     HttpContext.Current.Response.Cookies.Add(cookie);
 }
Beispiel #20
0
 /// <summary>
 /// SaveWorld event handler which notifies users that the server may lag
 /// </summary>
 public void OnSaveWorld(bool resettime = false, HandledEventArgs e = null)
 {
     // Protect against internal errors causing save failures
     // These can be caused by an unexpected error such as a bad or out of date plugin
     try
     {
         TShock.Utils.Broadcast("Saving world. Momentary lag might result from this.", Color.Red);
     }
     catch (Exception ex)
     {
         Log.Error("World saved notification failed");
         Log.Error(ex.ToString());
     }
 }
 protected override void SetupControl(WebControl control) {
     base.SetupControl(control);
     if (ViewEditMode == ViewEditMode.Edit) {
         ListEditItemCollection items = ((ASPxComboBox)control).Items;
         items.Clear();
         ComboBoxItemsBuilder.Create()
         .WithPropertyEditor(this)
         .Build((enumerable, b) => items.AddRange(enumerable.Select(s => new ListEditItem(s)).ToList()), () => {
             var handledEventArgs = new HandledEventArgs();
             OnItemsCalculating(handledEventArgs);
             return handledEventArgs.Handled;
         });
     }
 }
Beispiel #22
0
        public void OnChat(messageBuffer msg, int ply, string text, HandledEventArgs e)
        {
            if (e.Handled)
                return;

            var player = QTools.GetPlayerByID(ply);
            if (player.AwaitingChat)
            {
                player.LastChatMessage = text;
                player.AwaitingChat = false;

                if (player.HideChat)
                    e.Handled = true;
            }
        }
Beispiel #23
0
        public bool PreFilterMessage(ref Message message)
        {
            if (message.Msg != GlobalHotKey.WM_HOTKEY)
                return false;

            if (!this.registered)
                return false;

            if (message.WParam.ToInt32() != id)
                return false;

            if (OnPressed == null)
                return false;

            HandledEventArgs handledEventArgs = new HandledEventArgs(false);
            OnPressed(this, handledEventArgs);

            // Return whether we handled the event or not
            return handledEventArgs.Handled;
        }
 private void FrameOnTemplateChanged(object sender, EventArgs args) {
     var mainForm = Frame.Template as MainForm;
     if (mainForm != null){
         mainForm.Closing += MainFormOnClosing;
         mainForm.Shown += (o, eventArgs) => { _mainFormClosing = false; };
     }
     var handledEventArgs = new HandledEventArgs();
     OnCanClose(handledEventArgs);
     if (handledEventArgs.Handled) {
         var form = Frame.Template as XtraForm;
         if (form != null) {
             Application.LoggingOff += ApplicationOnLoggingOff;
             Application.LoggedOff += ApplicationOnLoggedOff;
             form.FormClosing += FormOnFormClosing;
             form.Closing += FormOnClosing;
             var editModelAction = Frame.GetController<DevExpress.ExpressApp.Win.SystemModule.EditModelController>().EditModelAction;
             editModelAction.Executing += (o, eventArgs) => _editing = true;
             editModelAction.ExecuteCompleted += (o, eventArgs) => _editing = false;
         }
     }
 }
Beispiel #25
0
 private void OnMoveMade(object sender, HandledEventArgs e)
 {
     // Blur or unblur based on whether the move was a valid one.
     BlurBitmapEffect blur = (BlurBitmapEffect)ControlPanel.BitmapEffect;
     if (blur != null)
     {
         if (e.Handled)
         {
             if (blur.Radius >= 2.0)
             {
                 blur.Radius -= 2.0;
             }
             StatusLabel.Content = "";
         }
         else
         {
             blur.Radius += 2.0;
             StatusLabel.Content = "Bad Move!";
         }
     }
 }
Beispiel #26
0
        private void OnChat(messageBuffer msgb, int pid, string msg, HandledEventArgs args)
        {
            if (args.Handled)
                return;

            TSPlayer sender = TShock.Players[msgb.whoAmI];
            if (sender == null)
            {
                args.Handled = true;
                return;
            }

            if (msg.StartsWith("!"))
            {
                args.Handled = true;
                string[] Messagearr = msg.Split(' ');
                string cmd = Messagearr[0].Substring(1);
                switch (cmd)
                {
                    case "red":
                        Chat(Color.Red, Messagearr,sender.Name);
                        break;
                    case "green":
                        Chat(Color.Green, Messagearr, sender.Name);
                        break;
                    case "whisp":
                        Whisper(sender, Messagearr);
                        break;

                    default:
                        sender.SendMessage("Erdbeerkäse =)");
                        break;

                }
            }
        }
Beispiel #27
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"></param>
 protected virtual void OnShowProperties(HandledEventArgs e)
 {
     if (ShowProperties != null) ShowProperties(this, e);
 }
Beispiel #28
0
        private void ShowPropertiesClick(object sender, EventArgs e)
        {
            // Allow subclasses to prevent this class from showing the default dialog
            HandledEventArgs result = new HandledEventArgs(false);
            OnShowProperties(result);
            if (result.Handled) return;

            if (_propertyDialogProvider == null) return;
            _editCopy = this.Copy();
            CopyProperties(_editCopy); // for some reason we are getting blank layers during edits, this tries to fix that

            _propertyDialogProvider.ShowDialog(_editCopy);
            LayerManager.DefaultLayerManager.ActiveProjectLayers = new List<ILayer>();
        }
Beispiel #29
0
        private bool OnPressed()
        {
            // Fire the event if we can
            HandledEventArgs handledEventArgs = new HandledEventArgs(false);
            if (this.Pressed != null)
            { this.Pressed(this, handledEventArgs); }

            // Return whether we handled the event or not
            return handledEventArgs.Handled;
        }
Beispiel #30
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"></param>
 protected virtual void OnShowProperties(HandledEventArgs e)
 {
     var h = ShowProperties;
     if (h != null) h(this, e);
 }