public void ClearListAsExpected()
 {
     Assert.Empty(_memberList);
     _memberList.Add(_fieldA);
     Assert.Single(_memberList);
     _memberList.Clear();
     Assert.Empty(_memberList);
 }
Beispiel #2
0
        public void GenerateContentPython(string file)
        {
            try
            {
                var code = File.ReadAllLines(file);

                MemberList.Clear();

                for (int i = 0; i < code.Length; i++)
                {
                    var line = code[i].TrimStart();

                    if (line.StartsWithAny("def ", "class "))
                    {
                        var info = new MemberInfo();
                        info.ContentIndent = new string(' ', (code[i].Length - line.Length));
                        info.Line          = i;

                        if (line.StartsWith("class "))
                        {
                            if (MemberList.Any())
                            {
                                MemberList.Add(new MemberInfo {
                                    Line = -1
                                });
                            }
                            info.ContentType = "class";
                            info.Content     = line.Substring("class ".Length).TrimEnd();
                        }
                        else
                        {
                            info.ContentType = "def";
                            info.Content     = line.Substring("def ".Length).TrimEnd();
                        }

                        MemberList.Add(info);
                    }
                }

                ErrorMessage = null;
            }
            catch (Exception e)
            {
                ErrorMessage = e.Message;
            }
        }
Beispiel #3
0
        //----------------------------------------------------------------------
        /// <summary>
        /// recursively add members to the node CommandList
        /// </summary>
        /// <param name="commandList">target command list</param>
        public void AddToStringList(StringList commandList)
        {
            // the root node node itself is not send for now.
            // Later we can send the 3 columns text to specify the header, if specfied.
            // the text should be like that : "Myfirstcol:150" where 150 is the column with
            // sub nodes, if any
            foreach (TMemberNode node in Members)
            {
                if (node != null)
                {
                    node._AddToStringList(commandList);
                }
            }

            // once copied to Commandlist, clear the array
            Members.Clear();
        }
Beispiel #4
0
        public async Task LoadAsync()
        {
            try
            {
                _controller = await _dialogService.ShowProgressAsync("");

                _controller?.SetIndeterminate();

                MemberList.Clear();
                var members = await Task.Run(async() => await _memberRepository.AllAsync());

                if (members == null)
                {
                    return;
                }

                foreach (var member in members)
                {
                    MemberList.Add(new MemberWrapper(member));
                }
            }
            catch (Exception ex)
            {
                while (ex.InnerException != null)
                {
                    ex = ex.InnerException;
                }

                await _dialogService.ShowMessageAsync("Internal Error", ex.Message);
            }
            finally
            {
                if (_controller != null && _controller.IsOpen)
                {
                    await _controller.CloseAsync();
                }
            }
        }
Beispiel #5
0
 public void Clear()
 {
     errorMessage = null;
     MemberList.Clear();
 }
 private void ClearResidenceDetails()
 {
     MemberList?.Clear();
     CurrentMember = null;
 }