Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="initAtom"></param>
        public override void OnInit(DictionaryAtom initAtom)
        {
            base.OnInit(initAtom);

            Contexts.Add(new PlayerChannelContext(this));
            Contexts.Add(new AttributeContext(this));
        }
        public void Associate(UntranslatedText key, object ui, InternalTranslationResult translationResult, ParserTranslationContext context, bool saveResultGlobally)
        {
            // if just one of the things associated with this job, wants to save it, we shall!
            SaveResultGlobally = SaveResultGlobally || saveResultGlobally;

            if (context != null)
            {
                Contexts.Add(context);
                context.Jobs.Add(this);

                TranslationType |= TranslationType.Token;
            }
            else
            {
                if (ui != null && !ui.IsSpammingComponent())
                {
                    Components.Add(new KeyAnd <object>(key, ui));
                }

                if (translationResult != null)
                {
                    TranslationResults.Add(new KeyAnd <InternalTranslationResult>(key, translationResult));
                }

                TranslationType |= TranslationType.Full;
            }
        }
Exemplo n.º 3
0
        public CraftContext(GenericReader reader)
        {
            int version = reader.ReadInt();

            m_Items = new List <CraftItem>();

            Owner = reader.ReadMobile();
            int sysIndex = reader.ReadInt();

            m_LastResourceIndex  = reader.ReadInt();
            m_LastResourceIndex2 = reader.ReadInt();
            m_LastGroupIndex     = reader.ReadInt();
            m_DoNotColor         = reader.ReadBool();
            m_MarkOption         = (CraftMarkOption)reader.ReadInt();
            m_QuestOption        = (CraftQuestOption)reader.ReadInt();

            m_MakeTotal = reader.ReadInt();

            System = GetCraftSystem(sysIndex);

            if (System != null && Owner != null)
            {
                System.AddContext(Owner, this);
                Contexts.Add(this);
            }
        }
Exemplo n.º 4
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            var dig = new OpenFileDialog();

            dig.Multiselect      = true;
            dig.Filter           = "sql files (*.sql)|*.sql";
            dig.RestoreDirectory = false;
            var rst = dig.ShowDialog();

            if (rst != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            // Init Cop Context
            tbSql.TabPages.Clear();
            Contexts.Clear();
            FileNames = dig.FileNames.ToList();
            foreach (var fpath in FileNames)
            {
                var fileName = HelperMethod.GetFileNameByPath(fpath);
                tbSql.TabPages.Add(fileName);
                Contexts.Add(new StyleCopContext(fpath));
            }

            InitRunContext();
            tbSql_SelectedIndexChanged(sender, EventArgs.Empty);
        }
        public async Task Shows_Error_When_Creating_Empty_Team(bool serverSide, BrowserType browserType, bool useHttpClient)
        {
            Contexts.Add(new BrowserTestContext(
                             nameof(ScrumMasterTest),
                             nameof(Shows_Error_When_Creating_Empty_Team),
                             browserType,
                             serverSide,
                             useHttpClient));

            await StartServer();

            StartClients();

            await ClientTest.OpenApplication();

            TakeScreenshot("01-Loading");
            ClientTest.AssertIndexPage();
            TakeScreenshot("02-Index");
            ClientTest.SubmitCreateTeamForm();
            ClientTest.AssertIndexPage();
            TakeScreenshot("03-RequiredError");

            var input    = ClientTest.CreateTeamForm.FindElement(By.Id("createTeam$teamName"));
            var required = input.FindElement(By.XPath("../span"));

            Assert.AreEqual("Required", required.Text);

            input    = ClientTest.CreateTeamForm.FindElement(By.Id("createTeam$scrumMasterName"));
            required = input.FindElement(By.XPath("../span"));
            Assert.AreEqual("Required", required.Text);
        }
        public async Task Shows_Error_When_Joining_Not_Existing_Team(bool serverSide, BrowserType browserType, bool useHttpClient)
        {
            Contexts.Add(new BrowserTestContext(
                             nameof(ScrumMasterTest),
                             nameof(Shows_Error_When_Joining_Not_Existing_Team),
                             browserType,
                             serverSide,
                             useHttpClient));

            await StartServer();

            StartClients();

            string team   = "My team";
            string member = "Test Member";

            await ClientTest.OpenApplication();

            TakeScreenshot("01-Loading");
            ClientTest.AssertIndexPage();
            TakeScreenshot("02-Index");
            ClientTest.FillJoinTeamForm(team, member);
            TakeScreenshot("03-JoinTeamForm");
            ClientTest.SubmitJoinTeamForm();
            await Task.Delay(500);

            ClientTest.AssertIndexPage();
            TakeScreenshot("04-Error");
            ClientTest.AssertMessageBox("Scrum Team \"My team\" does not exist. (Parameter 'teamName')");
        }
Exemplo n.º 7
0
 /// <summary>
 /// Create a new Message, setting the supplied values
 /// </summary>
 /// <param name="msgID"></param>
 /// <param name="msgStr"></param>
 /// <param name="firstContext"></param>
 public Message(string msgID, string msgStr, string firstContext)
     : this()
 {
     MsgID  = msgID;
     MsgStr = msgStr;
     Contexts.Add(firstContext);
 }
Exemplo n.º 8
0
        public void Start()
        {
            base.Start();
            // if (btGraph.StatesSource != null)
            // {
            //  if (!_sharedStoreObjects.ContainsKey(typeof(StateDSO))
            //      || ((StateDSO) _sharedStoreObjects[typeof(StateDSO)]).State == null)
            //  {
            //      _sharedStoreObjects.Add(typeof(StateDSO),
            //          new StateDSO() {State = btGraph.StatesSource.InitialState.SelectedValue});
            //  }
            // }

            foreach (var node in graph.nodes)
            {
                var aiNode = node as AINode;
                if (aiNode != null)
                {
                    var context = new Context(agentController, SharedDso, Contexts);
                    Contexts.Add(aiNode, context);
                    aiNode.Initialize(context);
                }
            }

            //_activeNodes.Add(_aiGraph.root);
        }
Exemplo n.º 9
0
 public void Addcontext(string contextName)
 {
     if (Contexts.Any(c => c.Name.EqualsIgnoreCase(contextName)))
     {
         throw new UserException(ExceptionType.ContextAlreadyExists, contextName);
     }
     Contexts.Add(DbToolContext.Default(contextName));
 }
Exemplo n.º 10
0
 public SimpleISerializableStruct(SerializationInfo info, StreamingContext context)
 {
     _history  = null;
     _contexts = null;
     Payload   = info.GetString(nameof(Payload));
     History.Add("serialization_ctor");
     Contexts.Add(context);
 }
Exemplo n.º 11
0
 public void Associate(TranslationContext context)
 {
     if (context != null)
     {
         Contexts.Add(context);
         context.Jobs.Add(this);
     }
 }
Exemplo n.º 12
0
        public void AddContext(TwitterAccountData data)
        {
            LogTo.Info($"Adding account data for {data.AccountName} ({data.UserId})");
            Contexts.Add(new ContextEntry(Notifier, data, Cache));

            SaveToFile();

            ContextsChanged?.Invoke(this, EventArgs.Empty);
        }
Exemplo n.º 13
0
            public IEnumerable <IEnumerable <IClusterNode> > AssignPartitions(AffinityFunctionContext context)
            {
                Assert.IsNotNull(_ignite);

                Contexts.Add(context);

                // All partitions are the same
                return(Enumerable.Range(0, Partitions).Select(x => context.CurrentTopologySnapshot));
            }
Exemplo n.º 14
0
        /// <summary>
        ///		Crea un contexto
        /// </summary>
        public ContextModel CreateContext(string key, string app)
        {
            ContextModel context = new ContextModel(key, app);

            // Asigna el manejador de eventos
            context.Logged += (sender, args) => RaiseLog(args.Item);
            // Añade el contexto a la colección
            return(Contexts.Add(key, context));
        }
Exemplo n.º 15
0
        public void AddContext(Context child)
        {
            child.Level = Level + 1;

            child.Parent = this;

            child.Tags.AddRange(child.Parent.Tags);

            Contexts.Add(child);
        }
Exemplo n.º 16
0
        public ActivitySelector()
        {
            Contexts.Add(new ActivitySelectContext(this));
            Contexts.Add(new NamedRuleSelectContext(this));

            this.EmptyText = Properties.Resources.AddRule;

            Removable = false;
            Resetable = false;
        }
Exemplo n.º 17
0
        /// <summary>
        ///     Only pass decrypted data to this method.
        /// </summary>
        /// <param name="data"></param>
        public void UpdateAccount(TwitterAccountData data)
        {
            LogTo.Info($"Updating account data for {data.AccountName} ({data.UserId})");
            var context = Contexts.FirstOrDefault(c => c.UserId == data.UserId);

            Contexts.Remove(context);

            Contexts.Add(new ContextEntry(Notifier, data, Cache));
            SaveToFile();
        }
Exemplo n.º 18
0
        private void InitRunContext()
        {
            txtLogger.Clear();
            pgbHandling.Value = 0;

            if (FileNames.Count == 0)
            {
                Contexts.Clear();
                Contexts.Add(StyleCopContext.Load(txtSql.Text));
            }
        }
Exemplo n.º 19
0
 public void Handle(
     object sender,
     ExceptionHandlerEventArgs args)
 {
     if (args.IsInboundPoolException) {
         InboundPoolContexts.Add(args.InboundPoolContext);
     }
     else {
         Contexts.Add(args.Context);
     }
 }
Exemplo n.º 20
0
 public void AddContext(string userName, Rbac context)
 {
     if (Contexts.ContainsKey(userName))
     {
         Contexts[userName] = context;
     }
     else
     {
         Contexts.Add(userName, context);
     }
 }
Exemplo n.º 21
0
        /// <summary>
        /// Loga todas as contas ao Twitter.
        /// </summary>
        public static void Login()
        {
            if (s_userNamesToLoginQueue.Count == 0)
            {
                return;
            }

            try
            {
                if (s_statusUpdatingTimer != null)
                {
                    s_statusUpdatingTimer.Change(int.MaxValue, int.MaxValue);
                }

                OnLoginStarting(EventArgs.Empty);

                while (s_userNamesToLoginQueue.Count > 0)
                {
                    // Remove usuário e senha do início da fila.
                    var userName    = s_userNamesToLoginQueue.Dequeue();
                    var accessToken = s_accessTokenQueue.Count > 0 ? s_accessTokenQueue.Dequeue() : null;
                    var oauthToken  = s_oauthTokenQueue.Count > 0 ? s_oauthTokenQueue.Dequeue() : null;

                    try
                    {
                        var ctx = CreateContext(accessToken, oauthToken);
                        Contexts.Add(ctx);

                        var query = from a in ctx.Account
                                    where a.Type == AccountType.VerifyCredentials
                                    select a;

                        Accounts.Add(new DGAccount(query.First()));
                    }
                    catch (Exception ex)
                    {
                        OnLoginFailed(new LoginFailedEventArgs(ex));
                        return;
                    }
                    Thread.Sleep(1000);
                }
            }
            finally
            {
                if (s_statusUpdatingTimer != null)
                {
                    s_statusUpdatingTimer.Change(s_millsecondsIntervalToUpdate, s_millsecondsIntervalToUpdate);
                }
            }

            s_statusUpdatingTimer = new Timer(UpdateStatusTimerCallback, null, s_millsecondsIntervalToUpdate, s_millsecondsIntervalToUpdate);
            OnLoginFinished(EventArgs.Empty);
        }
Exemplo n.º 22
0
        private void AddContext(ContextType contextType, string className, string name)
        {
            if (!string.IsNullOrWhiteSpace(name) && !string.IsNullOrWhiteSpace(name))
            {
                if (Contexts == null)
                {
                    Contexts = new List <Context>();
                }

                Contexts.Add(new Context(contextType, className, name));
            }
        }
Exemplo n.º 23
0
        public async Task <IActionResult> Create([Bind("Id,Name,Logo,Description")] Projects projects)
        {
            if (ModelState.IsValid)
            {
                projects.Id = Guid.NewGuid();
                _context.Add(projects);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(projects));
        }
Exemplo n.º 24
0
        private void TryConnect()
        {
            if (SelectedConnection.Text.TryConnect(out MongoContext context))
            {
                SelectedConnection.CanConnect  = true;
                SelectedConnection.ConnectedOn = DateTime.Now;
                context.Key = SelectedConnection.Key;

                Contexts.Add(context);
                Servers.Refresh();
            }
        }
Exemplo n.º 25
0
        public async Task <IActionResult> Create([Bind("GId ,Id,Summary,DependsOn,Modified,Product,Version,Reported,Status,Blocks,Commit_ID,Description,Author,Files,CreatedAt")] Project project)
        {
            if (ModelState.IsValid)
            {
                project.GId = Guid.NewGuid();
                _context.Add(project);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(project));
        }
Exemplo n.º 26
0
        public void Login(string username, string password, Action <bool> onComplete)
        {
            // TODO: Global progress bar
            InitAuth(username, password);
            _client.Users.GetAuthenticatedUserAsync(
                new Action <User>(
                    u =>
            {
                IsAuthenticated   = true;
                AuthenticatedUser = u;
                _username         = username;
                _password         = password;
                Dispatcher.BeginInvoke(() =>
                {
                    Contexts.Clear();
                    Contexts.Add(new Context()
                    {
                        User = u
                    });
                });

                _client.Organizations.GetOrganizationsAsync(AuthenticatedUser.Login,
                                                            orgs => Dispatcher.BeginInvoke(() =>
                {
                    foreach (var org in orgs)
                    {
                        Contexts.Add(new Context()
                        {
                            User = org
                        });
                    }
                }),
                                                            _exceptionAction);

                if (onComplete != null)
                {
                    onComplete(IsAuthenticated);
                }
            }),
                ex =>
            {
                if (ex.ErrorType == ErrorType.Unauthorized)
                {
                    Logout();

                    if (onComplete != null)
                    {
                        onComplete(IsAuthenticated);
                    }
                }
            });
        }
Exemplo n.º 27
0
        /// <summary>
        ///
        /// </summary>
        public virtual void OnInit(DictionaryAtom initAtom)
        {
            InitializationAtom = initAtom;
            EventManager       = initAtom.GetObject("EventManager").CastAs <EventManager>();
            StaticDataManager  = initAtom.GetObject("StaticDataManager").CastAs <StaticDataManager>();
            EntityManager      = initAtom.GetObject("EntityManager").CastAs <EntityManager>();
            Logger             = initAtom.GetObject("Logger").CastAs <LogWrapper>();

            Contexts.Add(new FlagContext(this));
            Contexts.Add(new TagContext(this));
            Contexts.Add(new BitContext(this));
            Contexts.Add(new PropertyContext(this));
        }
Exemplo n.º 28
0
        public async Task ScrumMaster_Can_Select_Estimation_Deck(bool serverSide, BrowserType browserType, bool useHttpClient)
        {
            Contexts.Add(new BrowserTestContext(
                             nameof(ScrumMasterTest),
                             nameof(ScrumMaster_Can_Select_Estimation_Deck),
                             browserType,
                             serverSide,
                             useHttpClient));

            await StartServer();

            StartClients();

            string team                 = "RPSLS";
            string scrumMaster          = "Initiator";
            string deckText             = "Rock, Paper, Scissors, Lizard, Spock";
            var    availableEstimations = new string[]
            {
                "\uD83D\uDC8E", // Rock
                "\uD83D\uDCDC", // Paper
                "\u2702",       // Scissors
                "\uD83E\uDD8E", // Lizard
                "\uD83D\uDD96", // Spock
            };

            await ClientTest.OpenApplication();

            TakeScreenshot("01-Loading");
            ClientTest.AssertIndexPage();
            TakeScreenshot("02-Index");
            ClientTest.FillCreateTeamForm(team, scrumMaster, "RockPaperScissorsLizardSpock", deckText);
            TakeScreenshot("03-CreateTeamForm");
            ClientTest.SubmitCreateTeamForm();
            ClientTest.AssertPlanningPokerPage("RPSLS", "Initiator");
            TakeScreenshot("04-PlanningPoker");
            ClientTest.AssertTeamName(team, scrumMaster);
            ClientTest.AssertScrumMasterInTeam(scrumMaster);
            ClientTest.AssertMembersInTeam();
            ClientTest.AssertObserversInTeam();
            ClientTest.StartEstimation();
            TakeScreenshot("05-EstimationStarted");
            ClientTest.AssertAvailableEstimations(availableEstimations);
            ClientTest.SelectEstimation(1);
            await Task.Delay(500);

            TakeScreenshot("06-Estimated");
            ClientTest.AssertSelectedEstimation(new KeyValuePair <string, string>(scrumMaster, availableEstimations[1]));
            ClientTest.Disconnect();
            TakeScreenshot("07-Disconnected");
        }
Exemplo n.º 29
0
 public PerfTestStepProvider(int actionsCount, int sharedFeatures, int actionFeatures)
 {
     for (int i = 0; i < this.RingSize; ++i)
     {
         FeatureSet shared = Enumerable.Range(1, sharedFeatures).ToDictionary(f => $"f{f}", f => f + i);
         List <Dictionary <string, FeatureSet> > actions = Enumerable.Range(1, actionsCount).Select(a => new Dictionary <string, FeatureSet> {
             { $"a{a}", Enumerable.Range(1, actionFeatures).ToDictionary(f => $"af{f}", f => f + i) }
         }).ToList();
         var context = new Dictionary <string, object> {
             { "GUser", shared }, { "_multi", actions }
         };
         var message = JsonConvert.SerializeObject(context);
         Contexts.Add(message);
     }
 }
Exemplo n.º 30
0
        public CraftContext(Mobile owner, CraftSystem system)
        {
            Owner  = owner;
            System = system;

            Items              = new List <CraftItem>();
            LastResourceIndex  = -1;
            LastResourceIndex2 = -1;
            LastGroupIndex     = -1;

            QuestOption        = CraftQuestOption.NonQuestItem;
            RequiredPlantHue   = PlantHue.None;
            RequiredPigmentHue = PlantPigmentHue.None;

            Contexts.Add(this);
        }