コード例 #1
0
        public FloatingForm(DockingManager dockingManager, Zone zone, ContextHandler contextHandler)
        {
            // The caller is responsible for setting our initial screen location
            this.StartPosition = FormStartPosition.Manual;

            // Not in task bar to prevent clutter
            this.ShowInTaskbar = false;

            // Make sure the main Form owns us
            this.Owner = dockingManager.Container.FindForm();

            // Need to know when the Zone is removed
            this.ControlRemoved += new ControlEventHandler(OnZoneRemoved);

            // Add the Zone as the only content of the Form
            Controls.Add(zone);

            // Default state
            _redocker = null;
            _intercept = false;
            _zone = zone;
            _dockingManager = dockingManager;

            // Assign any event handler for context menu
            if (contextHandler != null)
                this.Context += contextHandler;

            // Default color
            this.BackColor = _dockingManager.BackColor;
            this.ForeColor = _dockingManager.InactiveTextColor;

            // Monitor changes in the Zone content
            _zone.Windows.Inserted += new CollectionChange(OnWindowInserted);
            _zone.Windows.Removing += new CollectionChange(OnWindowRemoving);
            _zone.Windows.Removed += new CollectionChange(OnWindowRemoved);

            if (_zone.Windows.Count == 1)
            {
                // The first Window to be added. Tell it to hide details
                _zone.Windows[0].HideDetails();

                // Monitor change in window title
                _zone.Windows[0].FullTitleChanged += new EventHandler(OnFullTitleChanged);

                // Grab any existing title
                this.Text = _zone.Windows[0].FullTitle;
            }

            // Need to hook into message pump so that the ESCAPE key can be
            // intercepted when in redocking mode
            Application.AddMessageFilter(this);
        }
コード例 #2
0
		public static void HandleGameRolePlayTaxCollectorFightRequestMessage(WorldClient client, GameRolePlayTaxCollectorFightRequestMessage message)
		{
			TaxCollectorNpc actor = client.Character.Map.GetActor<TaxCollectorNpc>(message.taxCollectorId);
			FighterRefusedReasonEnum fighterRefusedReasonEnum = client.Character.CanAttack(actor);
			if (fighterRefusedReasonEnum != FighterRefusedReasonEnum.FIGHTER_ACCEPTED)
			{
				ContextHandler.SendChallengeFightJoinRefusedMessage(client, client.Character, fighterRefusedReasonEnum);
			}
			FightPvT fightPvT = Singleton<FightManager>.Instance.CreatePvTFight(client.Character.Map);
			fightPvT.RedTeam.AddFighter(client.Character.CreateFighter(fightPvT.RedTeam));
			fightPvT.BlueTeam.AddFighter(actor.CreateFighter(fightPvT.BlueTeam));
			fightPvT.StartPlacement();
		}
コード例 #3
0
        protected void ChallengeSuccessful()
        {
            if (this.m_state == ChallengeStateEnum.CHALLENGE_STATE_PENDING)
            {
                this.m_state = ChallengeStateEnum.CHALLENGE_STATE_SUCESSFUL;

                this.UnbindEvents();

                if (!this.Hidden)
                {
                    ContextHandler.SendChallengeResultMessage(this.m_fight.Clients, this.ChallengeId, true);
                }
            }
        }
コード例 #4
0
        public WindowDetailCaption(DockingManager manager, 
                                   Size fixedSize, 
                                   EventHandler closeHandler, 
                                   EventHandler restoreHandler, 
                                   EventHandler invertAutoHideHandler, 
                                   ContextHandler contextHandler)
            : base(manager)
        {
            // Setup correct color remapping depending on initial colors
            DefineButtonRemapping();

            // Default state
            _maxButton = null;
            _hideButton = null;
            _maxInterface = null;
            _redocker = null;
            _showCloseButton = true;
            _showHideButton = true;
            _ignoreHideButton = false;
            _pinnedImage = false;
            
            // Prevent flicker with double buffering and all painting inside WM_PAINT
			SetStyle(ControlStyles.DoubleBuffer | 
					 ControlStyles.AllPaintingInWmPaint |
					 ControlStyles.UserPaint, true);

            // Our size is always fixed at the required length in both directions
            // as one of the sizes will be provided for us because of our docking
            this.Size = fixedSize;

            if (closeHandler != null)
                this.Close += closeHandler;	

            if (restoreHandler != null)
                this.Restore += restoreHandler;	

            if (invertAutoHideHandler != null)
                this.InvertAutoHide += invertAutoHideHandler;
    
            if (contextHandler != null)
                this.Context += contextHandler;	

            // Let derived classes override the button creation
            CreateButtons();

            // Need to hook into message pump so that the ESCAPE key can be 
            // intercepted when in redocking mode
            Application.AddMessageFilter(this);
        }
コード例 #5
0
 /// <summary>
 /// Saves all the changes across all the contexts.
 /// </summary>
 public async Task SaveAsync(ContextHandler handler = null)
 {
     if (handler == null)
     {
         foreach (var context in _contexts)
         {
             await context.SaveChangesAsync();
         }
     }
     else
     {
         var context = GetContext(handler);
         await context.SaveChangesAsync();
     }
 }
コード例 #6
0
 /// <summary>
 /// Saves all the changes across all the contexts.
 /// </summary>
 public void Save(ContextHandler handler = null)
 {
     if (handler == null)
     {
         foreach (var context in _contexts)
         {
             context.SaveChanges();
         }
     }
     else
     {
         var context = GetContext(handler);
         context.SaveChanges();
     }
 }
コード例 #7
0
 public WindowDetailCaptionIDE(DockingManager manager,
                               EventHandler closeHandler,
                               EventHandler restoreHandler,
                               EventHandler invertAutoHideHandler,
                               ContextHandler contextHandler)
     : base(manager,
            new Size(_fixedLength, _fixedLength),
            closeHandler,
            restoreHandler,
            invertAutoHideHandler,
            contextHandler)
 {
     // Use specificed font in the caption
     UpdateCaptionHeight(manager.CaptionFont);
 }
コード例 #8
0
ファイル: ReduceBuffDuration.cs プロジェクト: Mixi59/Stump
        void ReduceBuffsDuration(FightActor actor, short duration)
        {
            foreach (var buff in actor.GetBuffs().Where(buff => buff.Dispellable == FightDispellableEnum.DISPELLABLE).Where(buff => buff.Duration > 0 && buff.Delay == 0).ToArray())
            {
                buff.Duration -= duration;

                if (buff.Duration <= 0)
                {
                    actor.RemoveBuff(buff);
                }
            }

            actor.TriggerBuffs(actor, BuffTriggerType.OnDispelled);
            ContextHandler.SendGameActionFightModifyEffectsDurationMessage(Fight.Clients, Effect.Id, Caster, actor, (short)-duration);
        }
コード例 #9
0
        public void ProjectContextShouldBeRefreshed()
        {
            ContextHandler handler = new ContextHandler() {
                InnerHandler = new FakeHttpMessageHandler()
            };

            Context context = ContextFactory.GetContext();

            HttpMessageInvoker invoker = Utilities.createHttpMessageInvoker(handler);
            HttpResponseMessage response = invoker.SendAsync(new HttpRequestMessage(), CancellationToken.None).Result;

            Context refresh = ContextFactory.GetContext();

            Assert.AreNotSame(context, refresh);
        }
コード例 #10
0
ファイル: MonsterGroup.cs プロジェクト: Mixi59/Stump
        public void FightWith(Character character)
        {
            if (character.Map != Map)
            {
                return;
            }

            // only this character and his group can join the fight
            if (AuthorizedAgressor != null && AuthorizedAgressor != character && AuthorizedAgressor.Client.Connected)
            {
                ContextHandler.SendChallengeFightJoinRefusedMessage(character.Client, character, FighterRefusedReasonEnum.TEAM_LIMITED_BY_MAINCHARACTER);
                return;
            }

            var reason = character.CanAttack(this);

            if (reason != FighterRefusedReasonEnum.FIGHTER_ACCEPTED)
            {
                ContextHandler.SendChallengeFightJoinRefusedMessage(character.Client, character, reason);
                return;
            }

            Map.Leave(this);

            if (Map.GetBlueFightPlacement().Length < CountInitialFighters())
            {
                character.SendServerMessage("Cannot start fight : Not enough fight placements");
                return;
            }

            var fight = FightManager.Instance.CreatePvMFight(Map);

            var monsterFighters = CreateFighters(fight.DefendersTeam).ToArray();

            fight.ChallengersTeam.AddFighter(character.CreateFighter(fight.ChallengersTeam));

            foreach (var monster in monsterFighters)
            {
                fight.DefendersTeam.AddFighter(monster);
            }

            Fight = fight;

            fight.StartPlacement();

            OnEnterFight(character);
            Fight.FightEnded += OnFightEnded;
        }
コード例 #11
0
        public void ContextHandlerRunReturnsContextView()
        {
            var handler = new ContextHandler {
                Context = "ContextTest1"
            };

            var result = handler.Run();

            Assert.AreEqual(typeof(ContextView), result.GetType());

            var view = (ContextView)result;

            Assert.AreEqual("ContextTest1", view.Context.Name);
            Assert.AreEqual(3, view.Assemblies.Count);
            Assert.AreEqual(16, view.Namespaces.Count);
        }
コード例 #12
0
        public void UpdateStatus(ChallengeStatusEnum status, FightActor from = null)
        {
            if (Status != ChallengeStatusEnum.RUNNING)
            {
                return;
            }

            Status = status;

            ContextHandler.SendChallengeResultMessage(Fight.Clients, this);

            if (Status == ChallengeStatusEnum.FAILED && @from is CharacterFighter)
            {
                BasicHandler.SendTextInformationMessage(Fight.Clients, TextInformationTypeEnum.TEXT_INFORMATION_MESSAGE, 188, ((CharacterFighter)from).Name, Id);
            }
        }
コード例 #13
0
        public void ProjectContextShouldBeRefreshed()
        {
            ContextHandler handler = new ContextHandler()
            {
                InnerHandler = new FakeHttpMessageHandler()
            };

            Context context = ContextFactory.GetContext();

            HttpMessageInvoker  invoker  = Utilities.createHttpMessageInvoker(handler);
            HttpResponseMessage response = invoker.SendAsync(new HttpRequestMessage(), CancellationToken.None).Result;

            Context refresh = ContextFactory.GetContext();

            Assert.AreNotSame(context, refresh);
        }
コード例 #14
0
        void OnTurnStopped(IFight fight, FightActor player)
        {
            if (fight.TimeLine.Next != this)
            {
                return;
            }

            var characterFighter = Summoner as CharacterFighter;

            if (characterFighter == null)
            {
                return;
            }

            ContextHandler.SendSlaveSwitchContextMessage(characterFighter.Character.Client, this);
        }
コード例 #15
0
        public override bool StartMove(Path movementPath)
        {
            if (!CanMove() || movementPath.IsEmpty())
            {
                return(false);
            }

            Position = movementPath.EndPathPosition;
            var keys = movementPath.GetServerPathKeys();

            Map.ForEach(entry => ContextHandler.SendGameMapMovementMessage(entry.Client, keys, this));

            StopMove();
            LastMoveDate = DateTime.Now;

            return(true);
        }
コード例 #16
0
        void OnReadyChanged(ArenaWaitingCharacter character, bool ready)
        {
            ArenaManager.Instance.ArenaTaskPool.ExecuteInContext(() =>
            {
                ContextHandler.SendGameRolePlayArenaFighterStatusMessage(m_clients, Id, character.Character, ready);

                if (DefendersTeam.MissingMembers != 0 || ChallengersTeam.MissingMembers != 0 ||
                    !DefendersTeam.Members.All(x => x.Ready) || !ChallengersTeam.Members.All(x => x.Ready))
                {
                    return;
                }

                m_fight = FightManager.Instance.CreateArenaFight(this);

                TeleportFighters();
            });
        }
コード例 #17
0
        public void AttributeHandlerMapBinderThrowsMapKeyNotFoundMapBinderException()
        {
            var binder  = new AttributeHandlerMapBinder();
            var handler = new ContextHandler();
            //empty map
            var map = new Dictionary <string, string>();

            try
            {
                binder.Bind(map, handler);
            }
            catch (MapKeyNotFoundMapBinderException ex)
            {
                Assert.AreEqual("{ctx}", ex.ExpectedKey);
                throw;
            }
        }
コード例 #18
0
ファイル: ArenaPopup.cs プロジェクト: Mixi59/Stump
        public override void Display()
        {
            ContextHandler.SendGameRolePlayArenaFightPropositionMessage(Character.Client, this, DisplayTime);

            ContextHandler.SendGameRolePlayArenaRegistrationStatusMessage(Character.Client, false,
                                                                          PvpArenaStepEnum.ARENA_STEP_WAITING_FIGHT, PvpArenaTypeEnum.ARENA_TYPE_3VS3);

            Character.ArenaPopup = this;

            try
            {
                m_timer = Character.Area.CallDelayed(DisplayTime * 1000, Deny);
            }
            catch (Exception ex)
            {
                Deny();
            }
        }
コード例 #19
0
        public WindowDetailCaptionPlain(DockingManager manager,
                                        EventHandler closeHandler,
                                        EventHandler restoreHandler,
                                        EventHandler invertAutoHideHandler,
                                        ContextHandler contextHandler)
            : base(manager,
                   new Size(_fixedLength, _fixedLength),
                   closeHandler,
                   restoreHandler,
                   invertAutoHideHandler,
                   contextHandler)
        {
            // Default to thinking we are docked on a left edge
            _dockLeft = true;

            // Modify painting to prevent overwriting the button control
            _buttonOffset = 1 + (_buttonWidth + _insetButton) * 2;
        }
コード例 #20
0
ファイル: TouchPanel.cs プロジェクト: Jypeli-JYU/Jypeli
 private void setContext(ref ListenContext context, bool enable, ContextHandler operation)
 {
     if ((context != null) == enable)
     {
         return;
     }
     if (enable)
     {
         context        = Game.Instance.ControlContext.CreateSubcontext();
         context.Active = true;
         operation(context);
     }
     else
     {
         context.Destroy();
         context = null;
     }
 }
コード例 #21
0
        /// <summary>
        /// Saves and then removes Character
        /// </summary>
        /// <remarks>Requires map context for synchronization.</remarks>
        internal void FinishLogout()
        {
            RealmServer.IOQueue.AddMessage(new Message(() =>
            {
                Record.LastLogout = DateTime.Now;
                SaveNow();

                var handler = ContextHandler;
                if (handler != null)
                {
                    ContextHandler.AddMessage(() => DoFinishLogout());
                }
                else
                {
                    DoFinishLogout();
                }
            }));
        }
コード例 #22
0
        public static void CommonCharacterBasicInformations(WorldClient client)
        {
            CharacterHandler.SendCharacterSelectedSuccessMessage(client);
            ContextHandler.SendNotificationListMessage(client, new int[] { 2147483647 });
            InventoryHandler.SendInventoryContentMessage(client);
            ShortcutHandler.SendShortcutBarContentMessage(client, ShortcutBarEnum.GENERAL_SHORTCUT_BAR);
            ShortcutHandler.SendShortcutBarContentMessage(client, ShortcutBarEnum.SPELL_SHORTCUT_BAR);
            ContextRoleplayHandler.SendEmoteListMessage(client, (
                                                            from entry in Enumerable.Range(0, 21)
                                                            select(byte) entry).ToList <byte>());

            PvPHandler.SendAlignmentRankUpdateMessage(client);
            if (client.Character.Guild != null)
            {
                GuildHandler.SendGuildMembershipMessage(client, client.Character.GuildMember);
                GuildHandler.SendGuildInformationsGeneralMessage(client, client.Character.Guild);
                GuildHandler.SendGuildInformationsMembersMessage(client, client.Character.Guild);
                if (client.Character.Guild.Alliance != null)
                {
                    AllianceHandler.SendAllianceMembershipMessage(client, client.Character.Guild.Alliance);
                    AllianceHandler.SendAllianceInsiderInfoMessage(client, client.Character.Guild.Alliance);
                }
            }
            ChatHandler.SendEnabledChannelsMessage(client, new sbyte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13 }, new sbyte[0]);
            InventoryHandler.SendSpellListMessage(client, true);
            InitializationHandler.SendSetCharacterRestrictionsMessage(client);
            InventoryHandler.SendInventoryWeightMessage(client);
            FriendHandler.SendFriendWarnOnConnectionStateMessage(client, client.Character.FriendsBook.WarnOnConnection);
            FriendHandler.SendFriendWarnOnLevelGainStateMessage(client, client.Character.FriendsBook.WarnOnLevel);
            GuildHandler.SendGuildMemberWarnOnConnectionStateMessage(client, client.Character.WarnOnGuildConnection);
            AchievementHandler.SendAchievementListMessage(client, client.Character.Record.FinishedAchievements, client.Character.Achievement.GetRewardableAchievements());
            client.Character.SendConnectionMessages();
            ContextRoleplayHandler.SendGameRolePlayArenaUpdatePlayerInfosMessage(client);
            CharacterHandler.SendCharacterCapabilitiesMessage(client);

            client.WorldAccount.LastConnection     = new System.DateTime?(System.DateTime.Now);
            client.WorldAccount.LastIp             = client.IP;
            client.WorldAccount.ConnectedCharacter = new int?(client.Character.Id);

            client.Character.Record.LastUsage = new System.DateTime?(System.DateTime.Now);
            ServerBase <WorldServer> .Instance.DBAccessor.Database.Update(client.WorldAccount);

            ServerBase <WorldServer> .Instance.DBAccessor.Database.Update(client.Character.Record);
        }
コード例 #23
0
        public override void Execute()
        {
            base.Execute();
            var target = this.Caster.Team.GetOneTree(this.TargetedCell);

            if (target != null)
            {
                var id     = target.PopNextBuffId();
                var effect = new EffectDice()
                {
                    Duration = DURATION
                };                                                     //TODO : Add EffectId
                var actionId = (short)ActionsEnum.ACTION_793;
                var buff     = new TriggerBuff(id, target, target, effect, base.Spell, false, true, BuffTriggerType.TURN_END, new TriggerBuffApplyHandler(TreeTrigger), actionId);

                target.AddAndApplyBuff(buff);
                ContextHandler.SendGameActionFightDispellableEffectMessage(base.Caster.Fight.Clients, buff);
            }
        }
コード例 #24
0
        public ActionResult Edit(Guid id, Guid rowId, Guid customerId, Guid productId)
        {
            try
            {
                using (var s = UnitOfWork)
                {
                    var cmd = new ChangeProductQuantityInOrderItemCommand { AggregateRootId = id, RowId = rowId, CustomerId = customerId, ProductId = productId, Quantity = 5 };
                    var ctx = new ContextHandler<Order, ChangeProductQuantityInOrderItemRole>(repo);
                    ctx.Bind(cmd)
                       .Execute();
                    s.Commit();
                }

            }
            catch (Exception err)
            {
            }
            return null;
        }
コード例 #25
0
ファイル: RevealsInvisible.cs プロジェクト: Mixi59/Stump
        protected override bool InternalApply()
        {
            var containedTraps = Fight.GetTriggers().OfType <Trap>().Where(entry => entry.VisibleState == GameActionFightInvisibilityStateEnum.INVISIBLE &&
                                                                           Caster.IsEnnemyWith(entry.Caster) &&
                                                                           AffectedCells.Contains(entry.Shape.Cell));

            foreach (var trap in containedTraps)
            {
                trap.VisibleState = GameActionFightInvisibilityStateEnum.VISIBLE;
                ContextHandler.SendGameActionFightMarkCellsMessage(Fight.Clients, trap);
            }

            foreach (var target in GetAffectedActors().Where(target => target.VisibleState == GameActionFightInvisibilityStateEnum.INVISIBLE && target.IsEnnemyWith(Caster)))
            {
                target.SetInvisibilityState(GameActionFightInvisibilityStateEnum.VISIBLE);
            }

            return(true);
        }
コード例 #26
0
        public ActionResult Register(CreateNewProductCommand cmd)
        {
            try
            {
                using (var s = UnitOfWork)
                {
                    ContextHandler<Product, CreateNewProductRole> ctx = new ContextHandler<Product, CreateNewProductRole>(repo);
                    ctx.Bind(cmd)
                       .Execute();
                    s.Commit();

                    return View();
                }
            }
            catch (Exception err)
            {
                return null;
            }
        }
コード例 #27
0
		public static void HandleGuildFightJoinRequestMessage(WorldClient client, GuildFightJoinRequestMessage message)
		{
			if (client.Character.Guild != null)
			{
				TaxCollectorNpc taxCollectorNpc = client.Character.Guild.TaxCollectors.FirstOrDefault((TaxCollectorNpc x) => x.GlobalId == message.taxCollectorId);
				if (taxCollectorNpc != null && taxCollectorNpc.IsFighting)
				{
					FightPvT fightPvT = taxCollectorNpc.Fighter.Fight as FightPvT;
					if (fightPvT != null)
					{
						FighterRefusedReasonEnum fighterRefusedReasonEnum = fightPvT.AddDefender(client.Character);
						if (fighterRefusedReasonEnum != FighterRefusedReasonEnum.FIGHTER_ACCEPTED)
						{
							ContextHandler.SendChallengeFightJoinRefusedMessage(client, client.Character, fighterRefusedReasonEnum);
						}
					}
				}
			}
		}
コード例 #28
0
        protected void ChallengeFailed()
        {
            if (this.m_state == ChallengeStateEnum.CHALLENGE_STATE_PENDING)
            {
                this.m_state = ChallengeStateEnum.CHALLENGE_STATE_FAILED;

                this.UnbindEvents();

                if (!this.Hidden)
                {
                    ContextHandler.SendChallengeResultMessage(this.m_fight.Clients, this.ChallengeId, false);

                    if (this.m_fight.FighterPlaying is CharacterFighter)
                    {
                        BasicHandler.SendTextInformationMessage(this.m_fight.Clients, TextInformationTypeEnum.TEXT_INFORMATION_MESSAGE, 188, (this.m_fight.FighterPlaying as CharacterFighter).Character.Name, this.ChallengeId);
                    }
                }
            }
        }
コード例 #29
0
        public ActionResult Register(CreateNewCustomerCommand cmd)
        {
            using (var s = UnitOfWork)
            {
                try
                {
                    ContextHandler <Customer, CreateNewCustomerRole> ctx = new ContextHandler <Customer, CreateNewCustomerRole>(repo);
                    ctx.Bind(cmd)
                    .Execute();
                    s.Commit();

                    return(View());
                }
                catch (Exception err)
                {
                    throw new Exception(err.Message);
                }
            }
        }
コード例 #30
0
        public ActionResult Register(CreateNewProductCommand cmd)
        {
            try
            {
                using (var s = UnitOfWork)
                {
                    ContextHandler <Product, CreateNewProductRole> ctx = new ContextHandler <Product, CreateNewProductRole>(repo);
                    ctx.Bind(cmd)
                    .Execute();
                    s.Commit();

                    return(View());
                }
            }
            catch (Exception err)
            {
                return(null);
            }
        }
コード例 #31
0
ファイル: TaxCollectorHandler.cs プロジェクト: Mixi59/Stump
        public static void HandleGameRolePlayTaxCollectorFightRequestMessage(WorldClient client, GameRolePlayTaxCollectorFightRequestMessage message)
        {
            var taxCollector = client.Character.Map.GetActor <TaxCollectorNpc>(message.taxCollectorId);

            var result = client.Character.CanAttack(taxCollector);

            if (result != FighterRefusedReasonEnum.FIGHTER_ACCEPTED)
            {
                ContextHandler.SendChallengeFightJoinRefusedMessage(client, client.Character, result);
                return;
            }

            var fight = FightManager.Instance.CreatePvTFight(client.Character.Map);

            fight.ChallengersTeam.AddFighter(client.Character.CreateFighter(fight.ChallengersTeam));
            fight.DefendersTeam.AddFighter(taxCollector.CreateFighter(fight.DefendersTeam));

            fight.StartPlacement();
        }
コード例 #32
0
 public void Start()
 {
     if (!this.m_started)
     {
         this.m_started = true;
         if (this.m_fighters.Count <= 0)
         {
             this.NotifySuccess();
         }
         else
         {
             foreach (CharacterFighter current in this.m_fighters)
             {
                 ContextHandler.SendGameFightTurnReadyRequestMessage(current.Character.Client, this.m_fight.TimeLine.Current);
             }
             this.m_timer = this.m_fight.Map.Area.CallDelayed(ReadyChecker.CheckTimeout, new Action(this.TimedOut));
         }
     }
 }
コード例 #33
0
        public ActionResult Register(CreateNewCustomerCommand cmd)
        {
            using (var s = UnitOfWork)
            {
                try
                {
                    ContextHandler<Customer, CreateNewCustomerRole> ctx = new ContextHandler<Customer, CreateNewCustomerRole>(repo);
                    ctx.Bind(cmd)
                       .Execute();
                    s.Commit();

                    return View();

                }
                catch(Exception err)
                {
                    throw new Exception(err.Message);
                }
            }
        }
コード例 #34
0
        public void AddToQueue(ArenaParty party)
        {
            if (!party.Members.All(CanJoinQueue))
            {
                return;
            }

            lock (m_queue)
                m_queue.Add(new ArenaQueueMember(party));

            ContextHandler.SendGameRolePlayArenaRegistrationStatusMessage(party.Clients, true,
                                                                          PvpArenaStepEnum.ARENA_STEP_REGISTRED, PvpArenaTypeEnum.ARENA_TYPE_3VS3);


            foreach (var character in party.Members.Where(x => x != party.Leader))
            {
                BasicHandler.SendTextInformationMessage(character.Client, TextInformationTypeEnum.TEXT_INFORMATION_MESSAGE, 272, party.Leader.Name);
            }
            //%1 vous a inscrit à un combat en Kolizéum.
        }
コード例 #35
0
 public ActionResult Edit(Guid id, Guid rowId, Guid customerId, Guid productId)
 {
     try
     {
         using (var s = UnitOfWork)
         {
             var cmd = new ChangeProductQuantityInOrderItemCommand {
                 AggregateRootId = id, RowId = rowId, CustomerId = customerId, ProductId = productId, Quantity = 5
             };
             var ctx = new ContextHandler <Order, ChangeProductQuantityInOrderItemRole>(repo);
             ctx.Bind(cmd)
             .Execute();
             s.Commit();
         }
     }
     catch (Exception err)
     {
     }
     return(null);
 }
コード例 #36
0
        public override bool StartMove(Path movementPath)
        {
            bool result;

            if (!this.CanMove() || movementPath.IsEmpty())
            {
                result = false;
            }
            else
            {
                this.Position = movementPath.EndPathPosition;
                System.Collections.Generic.IEnumerable <short> keys = movementPath.GetServerPathKeys();
                base.Map.ForEach(delegate(Character entry)
                {
                    ContextHandler.SendGameMapMovementMessage(entry.Client, keys, this);
                });
                this.StopMove();
                this.LastMoveDate = System.DateTime.Now;
                result            = true;
            }
            return(result);
        }
コード例 #37
0
ファイル: main.cs プロジェクト: vantruc/skimpt
 /// <summary>
 /// This attaches the context menu to Windows
 /// </summary>
 private void attachToWindowsButton_Click(object sender, EventArgs e)
 {
     ContextHandler ch = new ContextHandler();
     if(!ch.Add())
     {
         utilities.ShowMessage("Unable to add to windows", "failed");
     }
 }
コード例 #38
0
ファイル: DockingManager.cs プロジェクト: uvbs/Holodeck
        public virtual Window CreateWindowForContent(Content c,
            EventHandler contentClose,
            EventHandler restore,
            EventHandler invertAutoHide,
            ContextHandler showContextMenu)
        {
            // Create new instance with correct style
            WindowContent wc = new WindowContentTabbed(this, _visualStyle);

            WindowDetailCaption wdc;

            // Create a style specific caption detail
            if (_visualStyle == VisualStyle.IDE)
                wdc = new WindowDetailCaptionIDE(this, contentClose, restore,
                                                 invertAutoHide, showContextMenu);
            else
                wdc = new WindowDetailCaptionPlain(this, contentClose, restore,
                                                   invertAutoHide, showContextMenu);

            // Add the caption to the window display
            wc.WindowDetails.Add(wdc);

            if (c != null)
            {
                // Add provided Content to this instance
                wc.Contents.Add(c);
            }

            return wc;
        }
コード例 #39
0
        private ActionResult MakeAnOrderComplete(CustomerOrderViewModel model)
        {
            try
            {
                var cmd = new MakeNewOrderCommand { CustomerId = new Guid(Request.Params["CustomerId"]) };
                foreach (var item in model.OrderItems)
                {
                    cmd.Quantities.Add(item.ProductId, item.Quantity);
                }

                using (var s = UnitOfWork)
                {
                    var ctx = new ContextHandler<Order, MakeNewOrderRole>(repo);
                    ctx.Bind(cmd)
                       .Execute();
                    s.Commit();
                }

                return MakeAnOrder();
            }
            catch(Exception err)
            {
                throw err;
            }
        }
コード例 #40
0
 public KeyboardHandler()
 {
     _realHandler = inGame;
 }
コード例 #41
0
        public WindowDetailCaptionPlain(DockingManager manager, 
            EventHandler closeHandler,
            EventHandler restoreHandler,
            EventHandler invertAutoHideHandler,
            ContextHandler contextHandler)
            : base(manager, 
                   new Size(_fixedLength, _fixedLength), 
                   closeHandler, 
                   restoreHandler, 
                   invertAutoHideHandler, 
                   contextHandler)
        {
            // Default to thinking we are docked on a left edge
            _dockLeft = true;

            // Modify painting to prevent overwriting the button control
            _buttonOffset = 1 + (_buttonWidth + _insetButton) * 2;
        }
コード例 #42
0
 public WindowDetailCaptionIDE(DockingManager manager, 
     EventHandler closeHandler,
     EventHandler restoreHandler,
     EventHandler invertAutoHideHandler,
     ContextHandler contextHandler)
     : base(manager, 
            new Size(_fixedLength, _fixedLength), 
            closeHandler, 
            restoreHandler, 
            invertAutoHideHandler,
            contextHandler)
 {
     // Use specificed font in the caption
     UpdateCaptionHeight(manager.CaptionFont);
 }