Exemplo n.º 1
0
        public void AppendContext(ContextList cShared)
        {
//System.Console.WriteLine("Appending context:\n" + cShared.ToString());
            if (cShared != null)
            {
                ContextList cList = cShared.CopyStack();

                cList.Newer = _cList;

                if (_cList != null)
                {
                    _cList.Older = cList;

                    _cList = cList;
                }
                else
                {
                    _cList = cList;
                }

                while (_cList.Older != null)
                {
                    _cList = _cList.Older;
                }
            }
        }
Exemplo n.º 2
0
        private void Acc_ConfirmationChanged(object sender, EventArgs e)
        {
            var acc = sender as AccountEntry;

            Debug.Assert(acc != null, "acc != null");

            acc.Data.ExecuteDecryptedAction(data => { ContextList.UpdateAccount(data); });
        }
Exemplo n.º 3
0
 public RulesEngineCodeContext(string libraryName)
 {
     LibraryName = libraryName;
     DeclaredVariables = new ContextList<string>();
     ContextStack = new Stack<string>();
     Lookups = new List<string>();
     Variables = new List<string>();
 }
Exemplo n.º 4
0
        private void ExecuteMakeDefaultAccountCommand(AccountEntry entry)
        {
            foreach (var acc in AddedAccounts)
            {
                acc.IsDefaultAccount = acc.Data.UserId == entry.Data.UserId;
            }

            ContextList.UpdateAllAccounts();
        }
Exemplo n.º 5
0
        private ContextList Copy(ContextList newer)
        {
            ContextList newStack = new ContextList(_first, newer);

            newStack._older = (_older == null) ?
                              _older : _older.Copy(newStack);

            return(newStack);
        }
Exemplo n.º 6
0
 protected override void OnAcceptClick(object sender, EventArgs e)
 {
     base.OnAcceptClick(sender, e);
     if (ContextList.TreeMode != ContextList.ListInfo.Tree)
     {
         ContextList.TreeMode = ContextList.ListInfo.Tree;
     }
     ContextList.RefreshBounds(true);
 }
Exemplo n.º 7
0
        public void AddContext(Context c)
        {
            ContextList cList = new ContextList(c, _cList);

            if (_cList != null)
            {
                _cList.Older = cList;
            }
            _cList = cList;
        }
Exemplo n.º 8
0
        private async void ExecuteDeleteAccountCommand(AccountEntry account)
        {
            var csa = new ConfirmServiceArgs(Strings.ConfirmDeleteAccount);

            if (!await ViewServiceRepository.Confirm(csa))
            {
                return;
            }

            AddedAccounts.Remove(account);
            ContextList.RemoveAccount(account.Data.UserId);
        }
Exemplo n.º 9
0
        public bool RecordContext()
        {
            ContextList.Add(this);

            if (ObjectKey.Length > 0)
            {
                if (!RecordContextInStringTable(ObjectKeyTable, ObjectKey, ErrorControl.Normal))
                {
                    return(false);
                }

                if (ContentTable.ContainsKey("Name") && FieldTableStore.IsTypeWithName(ObjectType))
                {
                    if (!RecordContextInStringTable(ObjectNameTable, ContentTable["Name"], ErrorControl.IgnoreIfFound))
                    {
                        return(false);
                    }
                }

                if (ContentTable.ContainsKey("InternalName") && FieldTableStore.IsTypeWithInternalName(ObjectType))
                {
                    if (!RecordContextInStringTable(ObjectInternalNameTable, ContentTable["InternalName"], ErrorControl.Normal))
                    {
                        return(false);
                    }
                }
            }
            else
            {
                if (!KeylessObjectTable.ContainsKey(ObjectType))
                {
                    KeylessObjectTable.Add(ObjectType, new List <ParsingContext>());
                }

                List <ParsingContext> TypedContextList = KeylessObjectTable[ObjectType];
                TypedContextList.Add(this);
            }

            if (ContentTable.ContainsKey("Id"))
            {
                if (!RecordContextInIntTable(ObjectIdTable, ContentTable["Id"]))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 10
0
 /// <summary>
 /// Picks the core´s current context, places it in a list for statistical purposes and then loads a new context
 /// in the Core and restores the remaining thread cycles.
 /// </summary>
 /// <param name="core"> Thre core whose context finished execution</param>
 private void LoadNewContext(Core core)
 {
     var oldContext = core.Context;
     ContextList.Add(oldContext); // Adds the ending context for statistic purposes
     var newContext = GetNewContext();
     if (newContext != null)
     {
         core.Context = newContext;
         core.RemainingThreadCycles = Quantum; // Sets the quantum as the remaining cycles for the new thread
         core.ThereAreContexts = true;
     }
     else
     {
         // No more threads to run, so high level threads finishes execution
         core.RemainingThreadCycles = Constants.NotRunningAnyThread;
         FinalizeHighLevelThread();
     }
 }
Exemplo n.º 11
0
        public static void SortRules(RuleEngineRule rule, ContextList<string> variables)
        {
            //var childList = rule.Children.ToArray();
            // Clear the children
            //rule.Children.Clear();
            if (rule.Children.Count > 0)
            {
                variables.PushContext();
                // Push a new variable context

                rule.Children = new RulesCollection(RuleEngineRule.SortedRules(rule.Children, variables.All.ToArray()), rule);
                foreach (var child in rule.Children)
                {
                    SortRules(child, variables);
                }
                variables.PopContext();
            }
            variables.Add(rule.Name);
        }
Exemplo n.º 12
0
        public static void SortRules(RuleEngineRule ratingRule)
        {
            var children = ratingRule.Children.ToArray();

            var variableContext = new ContextList<string>();
            variableContext.PushContext();

            var outputs = children.SelectMany(p => p.Outputs).ToArray();
            var variables = children.SelectMany(p => p.AllInputs).Except(outputs).ToList();

            foreach (var variable in variables)
            {
                variableContext.Add(variable);
            }

            SortRules(ratingRule, variableContext);

            variableContext.PopContext();
        }
Exemplo n.º 13
0
        private async void ExecuteAddAccountCommand()
        {
            PinEntryCancelled = new CancellationTokenSource();

            var result = await Authorizer.Authorize(DisplayPinPage, GetPinFromUser, PinEntryCancelled.Token);

            var accountData = result?.Data;

            if (accountData != null)
            {
                if (ContextList.Contexts.All(c => c.UserId != accountData.UserId))
                {
                    using (var ctx = new TwitterContext(result.Auth))
                    {
                        var twitterUser =
                            await
                            ctx.User.Where(tw => tw.Type == UserType.Show && tw.UserID == accountData.UserId && tw.IncludeEntities == false)
                            .SingleOrDefaultAsync();

                        accountData.ImageUrl = twitterUser.ProfileImageUrlHttps.Replace("_normal", "");
                    }

                    if (ContextList.Contexts.Count == 0)
                    {
                        accountData.IsDefault = true;
                    }
                    ContextList.AddContext(accountData);

                    var newColumns = await ViewServiceRepository.SelectAccountColumnTypes(accountData.UserId)
                                     ?? new ColumnDefinition[0];

                    if (newColumns.Any())
                    {
                        ColumnList.AddColumns(newColumns);
                    }
                }
            }

            Close(true);
        }
Exemplo n.º 14
0
        public List<ContextList> GetAllContextItemsList(PanelPreferences preferences)
        {
            var items = new List<ContextList>();

            foreach (var context in preferences.ContextCollection.ContextList)
            {

                ContextInfo contextInformation = preferences.ContextCollection.GetContextInformation(context.ContextItems[4].PanelSettings, context.ContextItems[2].PanelSettings, context.ContextIndex);
                string[] portalBaseUrl = contextInformation.PortalBaseUrl.Split('.');
                var contextUrl = String.Format("{0}.{1}", contextInformation.SubDomain, portalBaseUrl[1]);
                if (contextInformation.OpenPortalSkinFolder.Equals(string.Empty))
                {
                    var item = new ContextList(contextUrl + "  Available", contextInformation);
                    items.Insert(0, item);
                }
                else
                {
                    var item = new ContextList(contextUrl + "  " + contextInformation.Name, contextInformation);
                    items.Add(item);
                }
            }
            return items;
        }
Exemplo n.º 15
0
        public void Show(UIElement relativeTo, double offsetX, double offsetY)
        {
            ContextList.SelectedIndex = -1;

            GeneralTransform gt     = relativeTo.TransformToVisual((UIElement)this.Parent);
            Point            offset = gt.Transform(new Point(offsetX, offsetY));

            ContextPopup.VerticalOffset   = offset.Y;
            ContextPopup.HorizontalOffset = offset.X;
            ContextPopup.IsOpen           = true;

            ContextGrid.Measure(App.Current.RootVisual.DesiredSize);

            GeneralTransform transform = relativeTo.TransformToVisual(App.Current.RootVisual);
            double           distBetweenBottomOfPopupAndBottomOfWindow =
                App.Current.RootVisual.RenderSize.Height - offsetY -
                transform.Transform(new Point(0, ContextGrid.DesiredSize.Height)).Y;

            if (distBetweenBottomOfPopupAndBottomOfWindow < 0)
            {
                ContextPopup.VerticalOffset += distBetweenBottomOfPopupAndBottomOfWindow;
            }
            ContextList.Focus();
        }
Exemplo n.º 16
0
 public InvokeException(object val, ContextList cList)
 {
     _val   = val;
     _cList = cList;
 }
Exemplo n.º 17
0
 public ContextList(Context first, ContextList newer, ContextList older)
 {
     _first = first; _newer = newer; _older = older;
 }
Exemplo n.º 18
0
 public ContextList(Context first)
 {
     _first = first; _newer = null; _older = null;
 }
Exemplo n.º 19
0
 public CaptureException(Procedure proc)
 {
     _cList = null;
     _proc  = proc;
 }
Exemplo n.º 20
0
 public Continuation(ContextList cList)
 {
     _cList = cList;
 }