示例#1
0
        public Channel(string id, List <User> members, KeyMetadata keyMetadata, string name = null)
        {
            Id             = id;
            Members        = members;
            KeyInformation = keyMetadata;

            if (keyMetadata == KeyMetadata.InitiatorKeyNotDisplayed)
            {
                var key  = _keyHandler.ProduceKeys(8100);
                var _key = "";
                foreach (var number in key)
                {
                    var keyA = number / 90 + 1;
                    var keyB = number % 90 + 1;
                    _key = _key + MathematicalMappingLogic.TransformationTable[keyA] + MathematicalMappingLogic.TransformationTable[keyB];
                }

                DependencyService.Get <IStorage>().SetValueWithKey(Id, _key);
            }

            if (name == null)
            {
                if (members.Count > 1)
                {
                    Name = members[0].Username + " " + AppResources.And + " " + (members.Count - 1) + " " + AppResources.MoreMembers;
                }
                else
                {
                    Name = members[0].Username;
                }
            }
            else
            {
                Name = name;
            }
        }