Exemple #1
0
        private static ProfileResult ConvertTRexProfileResult(ProfileDataResult <ProfileCellData> trexResult)
        {
            var profile = ProcessProfileCells(trexResult.ProfileCells, trexResult.GridDistanceBetweenProfilePoints, Guid.Empty);

            CheckForProductionDataPresence(profile);

            return(profile);
        }
Exemple #2
0
        public StatusAccountPage(ProfileDataResult profileData, ServiceNode serviceNode, long accountId, StatusAccountProfileType profileType, long transactionId) : base("StatusAccountPage")
        {
            Subscribe <SubscriptionEvent>(Subscription);
            Subscribe <ProfileDataResultEvent>(ProfileData);

            StackLayout.Suspended = true;

            _transactionId = transactionId;
            _profileType   = profileType;
            _serviceNode   = serviceNode;
            _status        = StatusApp.Current.GetStatus(serviceNode);
            _accountId     = accountId;
            _accountIndex  = Chain.Index.New().Add(_accountId).Build();

            _messagesDownload = new AccountIndexTransactionDownload(accountId, StatusServiceInfo.MessageIndex, serviceNode.GetTransactionDownloadManager(StatusServiceInfo.StatusDataChainIndex))
            {
                Count = 10
            };

            AddTitleRow("Title");

            if (profileType == StatusAccountProfileType.Small || transactionId > 0)
            {
                var row = new StatusProfileButtonRow(serviceNode, _accountId, profileData?.ProfileInfo, profileData, async(button) =>
                {
                    await Navigation.PushAsync(new StatusAccountPage(profileData, serviceNode, accountId, StatusAccountProfileType.Big, transactionId));
                }, false);

                AddRow(row);
            }

            if (profileType == StatusAccountProfileType.Big && transactionId <= 0)
            {
                if (_status != null)
                {
                    AddHeaderRow("Subscription");

                    _subscribe = AddSwitchRow("Subscribe");
                    _subscribe.Switch.IsToggled    = _status.IsSubscribed(_accountId);
                    _subscribe.Switch.ToggledAsync = Subscribe_Toggled;
                    _subscribe.SetDetailViewIcon(Icons.Check);

                    _notification = AddSwitchRow("Notification");
                    _notification.Switch.IsToggled    = UIApp.Current.IsPushChannelSubscribed(_accountIndex);
                    _notification.Switch.ToggledAsync = Notification_Toggled;
                    _notification.SetDetailViewIcon(Icons.Bell);

                    AddFooterRow();
                }

                if (profileData == null || profileType == StatusAccountProfileType.Big)
                {
                    UIApp.Run(() => ProfileManager.Current.GetProfileData(_accountId, ProfileDownloadType.ForceDownload, true));
                }
            }

            IsBusy = true;
        }
Exemple #3
0
        Task Setup(ProfileDataResult profileData)
        {
            if (profileData.ImageResult != ProfileDownloadResult.NetworkError && profileData.ProfileJsonResult != ProfileDownloadResult.NetworkError)
            {
                SetupEdit(profileData);
                return(Task.CompletedTask);
            }

            AddHeaderRow("TimeoutSection");
            AddTextRow("TimeoutText");
            AddFooterRow();

            return(Task.CompletedTask);
        }
Exemple #4
0
        /// <summary>
        /// Convert TRex data to the data to return from the Web API
        /// </summary>
        /// <param name="trexResult">Result data from TRex.</param>
        /// <param name="calcType"></param>
        /// <returns>The profile data</returns>
        private CompactionProfileResult <CompactionSummaryVolumesProfileCell> ConvertTRexSummaryVolumesProfileResult(ProfileDataResult <SummaryVolumeProfileCell> trexResult, VolumeCalcType calcType)
        {
            log.LogDebug("Converting summary volumes profile TRex result");

            return(ProcessSummaryVolumesProfileCells(trexResult.ProfileCells, trexResult.GridDistanceBetweenProfilePoints, calcType));;
        }
Exemple #5
0
        /// <summary>
        /// Convert TRex data to the data to return from the Web API
        /// </summary>
        /// <param name="trexResult">Result data from TRex.</param>
        /// <param name="calcType"></param>
        /// <returns>The profile data</returns>
        private CompactionProfileResult <CompactionProfileCell> ConvertTRexProductioDataProfileResult(ProfileDataResult <ProfileCellData> trexResult, LiftBuildSettings liftBuildSettings)
        {
            log.LogDebug("Converting production data profile TRex result");

            return(ProcessProductionDataProfileCells(trexResult.ProfileCells, trexResult.GridDistanceBetweenProfilePoints, liftBuildSettings));
        }
Exemple #6
0
        public ChatProfileButtonRow(ServiceNode serviceNode, long accountId, ProfileInfo profileInfo, ProfileDataResult profileData, Func <ProfileButtonRow, Task> action, bool showCount) : base(accountId, profileInfo, profileData, action, AccentColorExtenstion.DefaultAccentColorWith)
        {
            if (showCount)
            {
                RowLayout.Children.Remove(FontIcon);

                _countLabel.InputTransparent = true;
                _countLabel.FontStyle        = Theme.DetailFont;
                _countLabel.ColorStyle       = Theme.TextColor;

                _countLabel.Margin = new Thickness(0, 0, 10, 0);

                AbsoluteLayout.SetLayoutFlags(_countLabel, AbsoluteLayoutFlags.PositionProportional);
                RowLayout.Children.Add(_countLabel, new Point(1, 0.5));
            }

            RowLayout.SetAccentColor(serviceNode.AccentColor);
        }
Exemple #7
0
        void SetupEdit(ProfileDataResult profileData)
        {
            _profileData = profileData;

            AddHeaderRow("ImageSection");
            _image = AddImageRow(1, "Image");
            if (profileData.Image != null)
            {
                _image.ImageView.Source = ImageSource.FromStream(() => new MemoryStream(profileData.Image));
            }
            else
            {
                _image.ImageView.Source = AccountDummyImage.ImageSource;
            }

            var sel = AddButtonRow("SelectImage", SelectImage);

            sel.SetDetailViewIcon(Icons.UserCircle);
            Status.AddBusyView(sel);
            AddFooterRow();

            AddHeaderRow("EditSection");

            _profileName = AddEntryRow(ProfileItemJson.GetItemValue(profileData.ProfileJsonItems, ProfileItemJson.ProfileNameItem), "ProfileName");
            _profileName.SetDetailViewIcon(Icons.FullName);

            _realName = AddEntryRow(ProfileItemJson.GetItemValue(profileData.ProfileJsonItems, ProfileItemJson.RealNameItem), "RealName");
            _realName.SetDetailViewIcon(Icons.UserAlt);

            _bio = AddEntryRow(ProfileItemJson.GetItemValue(profileData.ProfileJsonItems, ProfileItemJson.BioItem), "Bio");
            _bio.SetDetailViewIcon(Icons.Info);

            Status.Add(_profileName.Edit, T("ProfileNameStatus"), (sv, edit, newValue, oldVAlue) =>
            {
                var valid = ProfileServiceInfo.IsProfileNameValid(newValue);
                if (!valid)
                {
                    edit.Text = ProfileServiceInfo.ToValidProfileName(newValue);
                }
                return(valid);
            });
            Status.Add(_realName.Edit, T("RealNameStatus"), (sv, edit, newValue, oldVAlue) =>
            {
                return(ProfileServiceInfo.IsRealNameValid(newValue));
            });

            Status.Add(_bio.Edit, T("BioStatus"), StatusValidators.NoEmptyString);

            if (profileData.ProfileJsonItems != null)
            {
                foreach (var item in profileData.ProfileJsonItems)
                {
                    AddProfileButton(item);
                }
            }

            Status.AddBusyView(AddButtonRow("AddItemButton", AddItem));

            AddFooterRow();

            AddSubmitRow("Common.Submit", Submit);
        }