Esempio n. 1
0
        public override void LoadFromStore(VMStore modelStore)
        {
            try
            {
                Profile               = JsonConvert.DeserializeObject <ClientProfileDTO>(modelStore.Store);
                Downloaded            = Profile.Downloaded;
                ClientId              = Profile.ClientId;
                SelectedMaritalStatus = MaritalStatus.FirstOrDefault(x => x.Id == Profile.MaritalStatus);
                SelectedKeyPop        = KeyPops.FirstOrDefault(x => x.Id == Profile.KeyPop);
                OtherKeyPop           = Profile.OtherKeyPop;
                SelectedEducation     = Educations.FirstOrDefault(x => x.ItemId == Profile.Education);
                SelectedCompletion    = Completions.FirstOrDefault(x => x.ItemId == Profile.Completion);
                SelectedOccupation    = Occupations.FirstOrDefault(x => x.ItemId == Profile.Occupation);

                if (null != Profile.RelTypeId && !string.IsNullOrWhiteSpace(Profile.RelTypeId))
                {
                    SelectedRelationshipType =
                        RelationshipTypes.FirstOrDefault(x => x.Description.ToLower() == Profile.RelTypeId.ToLower());
                }
            }
            catch (Exception e)
            {
                Mvx.Error(e.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Selects the best match to what the user typed
        /// </summary>
        /// <remarks>
        /// The steps to determine the best match:
        /// 1. Check if there is a precise match in the builders list
        /// 2. If not - check if there is a precise match in the completions list
        /// 3. If not - look up the closest match in the completions list
        /// </remarks>
        public override void SelectBestMatch()
        {
            string prefix = getPrefix();

            // precise match to a completion builder
            Completion completion = CompletionBuilders.FirstOrDefault(c => c.DisplayText.CompareTo(prefix) == 0);

            // if none - precise match to a completion
            if (completion == null)
            {
                completion = Completions.FirstOrDefault(c => c.DisplayText.CompareTo(prefix) == 0);
            }

            // if none - position the completion list
            if (completion == null)
            {
                completion = Completions.FirstOrDefault(c => c.DisplayText.CompareTo(prefix) >= 0);
            }

            if (completion != null)
            {
                SelectionStatus = new CompletionSelectionStatus(completion,
                                                                completion.DisplayText == prefix,
                                                                true
                                                                );
            }
        }
Esempio n. 3
0
        public async void TypeChar_ProducesExpectedCompletion()
        {
            var driver = MirrorSharpTestDriver.New(Options, FSharpLanguage.Name);

            driver.SetTextWithCursor(@"
                type Test() =
                    member this.Method() = ()

                let test = 
                    let t = new Test()
                    t|
            ".Trim().Replace("                ", ""));

            var result = await driver.SendTypeCharAsync('.');

            Assert.NotNull(result);
            Assert.Equal(
                new[] {
                new { DisplayText = "Equals", Kind = "method" },
                new { DisplayText = "GetHashCode", Kind = "method" },
                new { DisplayText = "GetType", Kind = "method" },
                new { DisplayText = "Method", Kind = "method" },
                new { DisplayText = "ToString", Kind = "method" },
            },
                // https://github.com/xunit/assert.xunit/pull/36#issuecomment-578990557
                result !.Completions.Select(c => new { c.DisplayText, Kind = c.Kinds.SingleOrDefault() })
                );
        }
Esempio n. 4
0
        public CompletionStreamResponse(Optional <Checkpoint> checkpoint, IEnumerable <Com.Daml.Ledger.Api.V1.Completion> completions)
        {
            Checkpoint = checkpoint;
            Completions.AddRange(completions);

            _hashCode = new HashCodeHelper().Add(Checkpoint).AddRange(Completions, CompletionComparer).ToHashCode();
        }
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
        internal LearnedCompletionData(
            string command,
            string parameter,
            params string[] completions)
        {
            CommandName   = command;
            ParameterName = parameter;
            Completions.AddRange(completions);
        }
        public ParameterContextFacade ToParameterContextFacade(IFrameworkFacade facade, INakedObjectsFramework framework)
        {
            var pc = new ParameterContextFacade {
                Parameter   = new ActionParameterFacade(Parameter, facade, framework, OverloadedUniqueId ?? ""),
                Action      = new ActionFacade(Action, facade, framework, OverloadedUniqueId ?? ""),
                Completions = Completions?.ToListContextFacade(facade, framework)
            };

            return(ToContextFacade(pc, facade, framework));
        }
        public PropertyContextFacade ToPropertyContextFacade(IFrameworkFacade facade, INakedObjectsFramework framework)
        {
            var pc = new PropertyContextFacade {
                Property    = new AssociationFacade(Property, facade, framework),
                Completions = Completions?.ToListContextFacade(facade, framework),
                Mutated     = Mutated
            };

            return(ToContextFacade(pc, facade, framework));
        }
Esempio n. 8
0
        public IStat CreateStat(string statType)
        {
            IStat stat = null;

            switch (statType)
            {
            case "Q":
                stat = new Sack();
                break;

            case "Y":
                stat = new YardsRushing();
                break;

            case "R":
                stat = new Carries();
                break;

            case "C":
                stat = new Completions();
                break;

            case "A":
                stat = new PassAttempts();
                break;

            case "S":
                stat = new YardsPassing();
                break;

            case "Z":
                stat = new PassesIntercepted();
                break;

            case "P":
                stat = new PassesCaught();
                break;

            case "G":
                stat = new YardsReceiving();
                break;

            case "M":
                stat = new InterceptionsMade();
                break;

            default:
                RosterLib.Utility.Announce(string.Format("A stat of type {0} cannot be found", statType));
                break;
            }

            return(stat);
        }
        public override void SelectBestMatch()
        {
            var filterText       = ApplicableTo.GetText(ApplicableTo.TextBuffer.CurrentSnapshot).TrimEnd();
            var directMatchItems = Completions.Where(c => DoesCompletionMatchApplicabilityTextDirect(c, filterText, CompletionMatchType.MatchInsertionText, false)).ToArray();

            if (directMatchItems.Any())
            {
                this.SelectionStatus = new CompletionSelectionStatus(directMatchItems[0], true, directMatchItems.Length == 1);
            }
            else
            {
                this.SelectionStatus = new CompletionSelectionStatus(null, false, false);
            }
        }
Esempio n. 10
0
        public override void Filter()
        {
            var filterText = FilterSpan.GetText(FilterSpan.TextBuffer.CurrentSnapshot);
            Predicate <Completion> predicate = delegate(Completion completion)
            {
                var startIndex = completion.DisplayText.StartsWith(InitialApplicableTo, StringComparison.OrdinalIgnoreCase) ? InitialApplicableTo.Length : 0;
                return(completion.DisplayText.IndexOf(filterText, startIndex, StringComparison.OrdinalIgnoreCase) != -1);
            };

            if (Completions.Any(current => predicate(current)))
            {
                completions.Filter(predicate);
            }
        }
Esempio n. 11
0
        public override void ViewAppeared()
        {
            IndexClientName = string.Empty;
            IsRelation      = false;

            base.ViewAppeared();
            var indexJson = _settings.GetValue(nameof(IndexClientDTO), "");

            if (!string.IsNullOrWhiteSpace(indexJson))
            {
                IsRelation     = true;
                IndexClientDTO = JsonConvert.DeserializeObject <IndexClientDTO>(indexJson);
                if (null != IndexClientDTO)
                {
                    MoveNextLabel     = "SAVE";
                    IndexClientName   = $"Relation To Index [{IndexClientDTO}]";
                    Title             = $"Profile [{IndexClientDTO.RelType}]";
                    RelationshipTypes = RelationshipTypes
                                        .Where(x => x.Description.ToLower() == IndexClientDTO.RelType.ToLower()).ToList();
                }
            }

            var preventEnroll = _settings.GetValue("PreventEnroll", "");

            if (!string.IsNullOrWhiteSpace(preventEnroll))
            {
                MoveNextLabel = Convert.ToBoolean(preventEnroll) ? "SAVE" : "NEXT";
            }

            var educationsJson  = _settings.GetValue("lookup.Education", "");
            var completionsJson = _settings.GetValue("lookup.Completion", "");
            var occupationsJson = _settings.GetValue("lookup.Occupation", "");

            if (!string.IsNullOrWhiteSpace(educationsJson) && !Educations.Any())
            {
                Educations = JsonConvert.DeserializeObject <List <CategoryItem> >(educationsJson);
            }

            if (!string.IsNullOrWhiteSpace(completionsJson) && !Completions.Any())
            {
                Completions = JsonConvert.DeserializeObject <List <CategoryItem> >(completionsJson);
            }

            if (!string.IsNullOrWhiteSpace(occupationsJson) && !Occupations.Any())
            {
                Occupations = JsonConvert.DeserializeObject <List <CategoryItem> >(occupationsJson);
            }
        }
Esempio n. 12
0
        protected ScriptConsole()
        {
            Contents.AddChild(new BoxContainer
            {
                Orientation = LayoutOrientation.Vertical,
                Children    =
                {
                    new PanelContainer
                    {
                        PanelOverride = new StyleBoxFlat
                        {
                            BackgroundColor           = Color.FromHex("#1E1E1E"),
                            ContentMarginLeftOverride = 4
                        },
                        Children =
                        {
                            (OutputPanel = new OutputPanel())
                        },
                        VerticalExpand = true,
                    },
                    new BoxContainer
                    {
                        Orientation = LayoutOrientation.Horizontal,
                        Children    =
                        {
                            (InputBar            = new HistoryLineEdit
                            {
                                HorizontalExpand = true,
                                PlaceHolder      = "Your C# code here."
                            }),
                            (RunButton           = new Button {
                                Text             = "Run"
                            })
                        }
                    },
                }
            });

            Suggestions             = new Completions(InputBar);
            InputBar.OnTabComplete += _ => Complete();
            InputBar.OnTextChanged += _ => Suggestions.TextChanged();
            InputBar.OnTextEntered += _ => Run();
            RunButton.OnPressed    += _ => Run();
            MinSize = (550, 300);
        }
Esempio n. 13
0
        public override void Start()
        {
            base.Start();
            MaritalStatus = _lookupService.GetMaritalStatuses(true).ToList();
            KeyPops       = _lookupService.GetKeyPops(true).ToList();
            Educations    = _lookupService.GetCategoryItems("Education", true, "[Select Education]").ToList();
            Completions   = _lookupService.GetCategoryItems("Completion", true, "[Select Completion]").ToList();
            Occupations   = _lookupService.GetCategoryItems("Occupation", true, "[Select Occupation]").ToList();

            try
            {
                SelectedMaritalStatus = MaritalStatus.FirstOrDefault(x => x.Id == "");
                SelectedKeyPop        = KeyPops.FirstOrDefault(x => x.Id == "");
                SelectedEducation     = Educations.FirstOrDefault(x => x.Id == Guid.Empty);
                SelectedCompletion    = Completions.FirstOrDefault(x => x.Id == Guid.Empty);
                SelectedOccupation    = Occupations.FirstOrDefault(x => x.Id == Guid.Empty);
            }
            catch {}
        }
Esempio n. 14
0
        public IStat CreateStat( string statType )
        {
            IStat stat = null;

            switch (statType)
            {
                case "Q":
                    stat = new Sack();
                    break;
                case "Y":
                    stat = new YardsRushing();
                    break;
                case "R":
                    stat = new Carries();
                    break;
                case "C":
                    stat = new Completions();
                    break;
                case "A":
                    stat = new PassAttempts();
                    break;
                case "S":
                    stat = new YardsPassing();
                    break;
                case "Z":
                    stat = new PassesIntercepted();
                    break;
                case "P":
                    stat = new PassesCaught();
                    break;
                case "G":
                    stat = new YardsReceiving();
                    break;
                case "M":
                    stat = new InterceptionsMade();
                    break;
                default:
                    RosterLib.Utility.Announce( string.Format("A stat of type {0} cannot be found", statType ) );
                    break;
            }

            return stat;
        }
Esempio n. 15
0
        private static async Task RunSample()
        {
            var auth = new AuthenticationClient();

            // Authenticate with Salesforce
            Console.WriteLine("Authenticating with Salesforce");
            var url = IsSandboxUser.Equals("true", StringComparison.CurrentCultureIgnoreCase)
                ? "https://test.salesforce.com/services/oauth2/token"
                : "https://login.salesforce.com/services/oauth2/token";

            await auth.UsernamePasswordAsync(ConsumerKey, ConsumerSecret, Username, Password, url);

            Console.WriteLine("Connected to Salesforce");

            var client = new ToolingClient(auth.InstanceUrl, auth.AccessToken, auth.ApiVersion);

            //Query existing Apex Classes
            Console.WriteLine("Get Classes");

            string qry              = "SELECT ID, Name FROM ApexClass";
            var    apexClasses      = new List <ApexClass>();
            var    apexClassResults = await client.QueryAsync <ApexClass>(qry);

            var totalSize = apexClassResults.totalSize;

            Console.WriteLine("Queried " + totalSize + " records.");

            //Query existing Profiles

            //Query existing Apex Classes
            Console.WriteLine("Get Completions");

            string type              = "apex";
            var    completions       = new Completions();
            var    completionResults = await client.CompletionsAsync <Completions>(type);

            Console.WriteLine("Queried " + totalSize + " records.");
        }
Esempio n. 16
0
        public IEnumerator TestGetAutocompletion()
        {
            Log.Debug("DiscoveryServiceV2IntegrationTests", "Attempting to GetAutocompletion...");
            Completions completionsResponse = null;

            service.GetAutocompletion(
                callback: (DetailedResponse <Completions> response, IBMError error) =>
            {
                Log.Debug("DiscoveryServiceV2IntegrationTests", "GetAutocompletion result: {0}", response.Response);
                completionsResponse = response.Result;
                Assert.IsNotNull(completionsResponse);
                Assert.IsNull(error);
            },
                projectId: projectId,
                prefix: "Ho",
                count: 5
                );

            while (completionsResponse == null)
            {
                yield return(null);
            }
        }
 public void SetCompletions(Completions completions) => _monacoBinding.SetCompletions(completions);