예제 #1
0
		private void PropertySave()
		{

			PropertiesController pc = new PropertiesController();
			PropertiesInfo pi = new PropertiesInfo();
			pi.PropertyId = -1;
			pi.PortalId = PortalId;
			pi = (PropertiesInfo)(Utilities.ConvertFromHashTableToObject(Params, pi));
			pi.Name = Utilities.CleanName(pi.Name);
			if (! (string.IsNullOrEmpty(pi.ValidationExpression)))
			{
				pi.ValidationExpression = HttpUtility.UrlDecode(HttpUtility.HtmlDecode(pi.ValidationExpression));
			}
			if (pi.PropertyId == -1)
			{
				string lbl = Params["Label"].ToString();
				LocalizationUtils lcUtils = new LocalizationUtils();
				lcUtils.SaveResource("[RESX:" + pi.Name + "].Text", lbl, PortalId);
			}
			else
			{
				if (Utilities.GetSharedResource("[RESX:" + pi.Name + "]").ToLowerInvariant().Trim() != Params["Label"].ToString().ToLowerInvariant().Trim())
				{
					LocalizationUtils lcUtils = new LocalizationUtils();
					lcUtils.SaveResource("[RESX:" + pi.Name + "].Text", Params["Label"].ToString(), PortalId);
				}

			}
			pc.SaveProperty(pi);
			ForumController fc = new ForumController();
			Forum fi = fc.GetForum(PortalId, ModuleId, pi.ObjectOwnerId, true);
			fi.HasProperties = true;
			fc.Forums_Save(PortalId, fi, false, false);

		}
예제 #2
0
 public override string GetLocalized(
     string key)
 {
     return(LocalizationUtils.GetLocalized(
                key));
 }
예제 #3
0
#pragma warning disable SS001 // Async methods should return a Task to make them awaitable
        protected override async void OnStartup(StartupEventArgs e)
        {
            await Memenim.MainWindow.Instance.ShowLoadingGrid(true)
            .ConfigureAwait(true);

            MainWindow = Memenim.MainWindow.Instance;

            await Task.Delay(TimeSpan.FromMilliseconds(200))
            .ConfigureAwait(true);

            Memenim.MainWindow.Instance.Show();

            base.OnStartup(e);

            await Task.Delay(TimeSpan.FromMilliseconds(500))
            .ConfigureAwait(true);

            LocalizationUtils.ReloadLocalizations <XamlLocalizationProvider>();
            LocalizationUtils.SwitchLocalization(
                SettingsManager.AppSettings.Language);
            LocalizationUtils.SetDefaultCulture("en-US");

            if (LocalizationUtils.Localizations.Count == 0)
            {
                return;
            }

            await StorageManager.Initialize()
            .ConfigureAwait(true);

            ProtocolManager.RegisterAll();

            await Task.Run(async() =>
            {
                LogManager.DeleteLogs(SettingsManager.AppSettings
                                      .LogRetentionDaysPeriod);

                try
                {
                    if (string.IsNullOrEmpty(
                            SettingsManager.PersistentSettings.GetCurrentUserLogin()))
                    {
                        Dispatcher.Invoke(() =>
                        {
                            NavigationController.Instance.RequestPage <LoginPage>();
                        });

                        return;
                    }

                    if (!SettingsManager.PersistentSettings.SetCurrentUser(
                            SettingsManager.PersistentSettings.GetCurrentUserLogin()))
                    {
                        SettingsManager.PersistentSettings.RemoveUser(
                            SettingsManager.PersistentSettings.GetCurrentUserLogin());

                        Dispatcher.Invoke(() =>
                        {
                            NavigationController.Instance.RequestPage <LoginPage>();
                        });

                        return;
                    }

                    var result = await PostApi.Get(
                        SettingsManager.PersistentSettings.CurrentUser.Token,
                        PostType.Popular, 1)
                                 .ConfigureAwait(false);

                    if (result.IsError &&
                        (result.Code == 400 || result.Code == 401))
                    {
                        SettingsManager.PersistentSettings.RemoveUser(
                            SettingsManager.PersistentSettings.CurrentUser.Login);

                        Dispatcher.Invoke(() =>
                        {
                            NavigationController.Instance.RequestPage <LoginPage>();
                        });

                        return;
                    }

                    Dispatcher.Invoke(() =>
                    {
                        NavigationController.Instance.RequestPage <FeedPage>();
                    });

                    if (!string.IsNullOrEmpty(AppStartupUri))
                    {
                        ProtocolManager.ParseUri(AppStartupUri);
                    }
                }
                catch (Exception)
                {
                    Dispatcher.Invoke(() =>
                    {
                        NavigationController.Instance.RequestPage <LoginPage>();
                    });
                }
            }).ConfigureAwait(true);

            await Task.Delay(TimeSpan.FromSeconds(1.5))
            .ConfigureAwait(true);

            await Memenim.MainWindow.Instance.ShowLoadingGrid(false)
            .ConfigureAwait(true);
        }
예제 #4
0
        private async void LoginButton_Click(object sender,
                                             RoutedEventArgs e)
        {
            LoginButton.IsEnabled              = false;
            GoToRegisterButton.IsEnabled       = false;
            LoginTextBox.IsEnabled             = false;
            PasswordTextBox.IsEnabled          = false;
            RememberMeCheckBox.IsEnabled       = false;
            OpenStoredAccountsButton.IsEnabled = false;

            try
            {
                var result = await UserApi.Login(
                    LoginTextBox.Text, PasswordTextBox.Password)
                             .ConfigureAwait(true);

                if (result.IsError)
                {
                    var title = LocalizationUtils
                                .GetLocalized("LoginErrorTitle");

                    await DialogManager.ShowMessageDialog(
                        title, result.Message)
                    .ConfigureAwait(true);

                    return;
                }

                if (RememberMeCheckBox.IsChecked == true)
                {
                    var setUserSuccess = SettingsManager.PersistentSettings.SetUser(
                        LoginTextBox.Text,
                        result.Data.Token,
                        result.Data.Id,
                        null);

                    if (!setUserSuccess)
                    {
                        return;
                    }

                    if (!SettingsManager.PersistentSettings.SetCurrentUser(
                            LoginTextBox.Text))
                    {
                        return;
                    }
                }
                else
                {
                    SettingsManager.PersistentSettings.RemoveUser(
                        LoginTextBox.Text);

                    if (!SettingsManager.PersistentSettings.SetCurrentUserTemporary(
                            LoginTextBox.Text,
                            result.Data.Token,
                            result.Data.Id))
                    {
                        return;
                    }
                }

                if (NavigationController.Instance.IsEmptyHistory())
                {
                    NavigationController.Instance.RequestPage <FeedPage>();
                }
                else
                {
                    NavigationController.Instance.GoBack();
                }
            }
            catch (Exception ex)
            {
                await DialogManager.ShowErrorDialog(ex.Message)
                .ConfigureAwait(true);
            }
            finally
            {
                PasswordTextBox.Clear();

                LoginButton.IsEnabled              = !IsLoginBlocked();
                GoToRegisterButton.IsEnabled       = true;
                LoginTextBox.IsEnabled             = true;
                PasswordTextBox.IsEnabled          = true;
                RememberMeCheckBox.IsEnabled       = true;
                OpenStoredAccountsButton.IsEnabled = true;
            }
        }
예제 #5
0
 public override bool TryGetLocalized(
     string key, out string value)
 {
     return(LocalizationUtils.TryGetLocalized(
                key, out value));
 }
    void Awake()
    {
        colorMenu.SetActive(false);
        indexFractionArea = -1;
        bookmark = GameObject.FindGameObjectWithTag("Bookmark");
        bookmark.SetActive(false);
        Cursor.SetCursor(MouseIconNo, Vector2.zero, CursorMode.Auto);

        mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();
        startingPoints.Add(SBSVector3.zero);
        startingPoints.Add(SBSVector3.left);
        startingPoints.Add(SBSVector3.right);
        startingPoints.Add(SBSVector3.up);
        startingPoints.Add(SBSVector3.down);
        lastOperation = FractionsOperations.SUBTRACTION;
        localizationUtils = GameObject.FindGameObjectWithTag("LevelRoot").GetComponent<LocalizationUtils>();

        Localizations.Instance.mcLanguage = "en";
        //if (Application.srcValue.Contains("language=de"))
        if (ExternalEventsManager.Instance.embeddingVariables.ContainsKey("language"))
        {
            if (ExternalEventsManager.Instance.embeddingVariables["language"].Equals("de"))
                Localizations.Instance.mcLanguage = "de";
            else if (ExternalEventsManager.Instance.embeddingVariables["language"].Equals("es"))
                Localizations.Instance.mcLanguage = "es";
        }

        if (ExternalEventsManager.Instance.embeddingVariables.ContainsKey("username"))
        {
            if ("" != ExternalEventsManager.Instance.embeddingVariables["username"])
            {
                user = ExternalEventsManager.Instance.embeddingVariables["username"];
                isLogged = true;
                isStudent = true;
            }
            else
            {
                isLogged = false;
            }
        }
        if (ExternalEventsManager.Instance.embeddingVariables.ContainsKey("tip"))
        {
            if ("" != ExternalEventsManager.Instance.embeddingVariables["tip"])
            {
                fileAddress = ExternalEventsManager.Instance.embeddingVariables["tip"];
                istaskDefined = true;
            }
            else
            {
                istaskDefined = false;
            }
        }

        if (ExternalEventsManager.Instance.embeddingVariables.ContainsKey("showStartPage"))
        {
            if ("" != ExternalEventsManager.Instance.embeddingVariables["showStartPage"])
            {
                if (ExternalEventsManager.Instance.embeddingVariables["showStartPage"] == "true")
                    showStartPage = true;
                else
                    showStartPage = false;
            }
        }

        /*   mappingInitConfiguration = new List<Configuration>();
           Configuration tmp = new Configuration();
           foreach(Button bt in initialConfigurationList)
           {
               tmp.operation = bt.gameObject;
               tmp.isActive = true;
               mappingInitConfiguration.Add(tmp);
           }*/

        /*CHEAT*/
        //  symbol.GetComponent<UIButton>().DisableBtn(false);
        saveAs.GetComponent<UIButton>().DisableBtn(false);
        saveNew.GetComponent<UIButton>().DisableBtn(false);

        buttonDictionary = new Dictionary<string, Button>();
        foreach (Button bt in barTool)
        {
            buttonDictionary.Add(bt.name, bt);
        }
        foreach (Button bt in barOperations)
        {
            buttonDictionary.Add(bt.name, bt);
        }
        foreach (Button bt in contextMenu.GetComponentsInChildren<Button>())
        {
            buttonDictionary.Add(bt.name, bt);
        }
        foreach (Button bt in contextMenuEquivalence.GetComponentsInChildren<Button>())
        {
            buttonDictionary.Add(bt.name, bt);
        }
        foreach (Button bt in actionMenu.GetComponentsInChildren<Button>())
        {
            buttonDictionary.Add(bt.name, bt);
        }

        //initialConfigurationList = new Dictionary<string, Button>();
        contextMenu.SetActive(false);
        contextMenuEquivalence.SetActive(false);
        actionMenu.SetActive(false);
        isMenuActive = false;

        Localizations.Instance.initialize();
        Localizations.Instance.listeners.Add(gameObject);
        Localizations.Instance.listeners.Add(localizationUtils.gameObject);

        localizationUtils.AddTranslationText(bookmark.GetComponentInChildren<Text>(), "{designer_mode}");
        localizationUtils.AddTranslationText(visitedTask, "{visited_task}");
        localizationUtils.AddTranslationText(lockedTask, "{locked_task}");
        localizationUtils.AddTranslationText(newTask, "{new_task}");
        initializeHighlightUIElement();
        indexHighlight = 0;
        actionsPopupBG = GameObject.FindGameObjectWithTag("PopupBG");
        actionsPopupBG.SetActive(false);

        #if UNITY_ANDROID || UNITY_IPHONE
        zoomController.GetComponent<Zoom>().HideUI();
        #endif
        //if(isStudent)

        /*CHEAT*/
        /*  isLogged = false;
          istaskDefined = false;*/
    }
예제 #7
0
        protected string RenderStatusHtml(IDataItemContainer cont)
        {
            var o   = cont.DataItem as OrderSnapshot;
            var sb  = new StringBuilder();
            var url = ResolveUrl("~/DesktopModules/Hotcakes/Core/Admin/Orders/ViewOrder.aspx?id=" + o.bvin);

            var payText = LocalizationUtils.GetOrderPaymentStatus(o.PaymentStatus,
                                                                  HccRequestContext.Current.MainContentCulture);
            var payImage = "";
            var payLink  = ResolveUrl("~/DesktopModules/Hotcakes/Core/Admin/Orders/OrderPayments.aspx?id=" + o.bvin);

            switch (o.PaymentStatus)
            {
            case OrderPaymentStatus.Overpaid:
                payImage = ResolveImgUrl("Lights/PaymentError.gif");
                break;

            case OrderPaymentStatus.PartiallyPaid:
                payImage = ResolveImgUrl("Lights/PaymentAuthorized.gif");
                break;

            case OrderPaymentStatus.Paid:
                payImage = ResolveImgUrl("Lights/PaymentComplete.gif");
                break;

            case OrderPaymentStatus.Unknown:
                payImage = ResolveImgUrl("Lights/PaymentNone.gif");
                break;

            case OrderPaymentStatus.Unpaid:
                payImage = ResolveImgUrl("Lights/PaymentNone.gif");
                break;
            }
            sb.Append("<a href=\"" + payLink + "\" title=\"" + payText + "\"><img src=\"" + payImage + "\" alt=\"" +
                      payText + "\" /></a>");


            var shipText = LocalizationUtils.GetOrderShippingStatus(o.ShippingStatus,
                                                                    HccRequestContext.Current.MainContentCulture);
            var shipImage = "";
            var shipLink  = ResolveUrl("~/DesktopModules/Hotcakes/Core/Admin/Orders/ShipOrder.aspx?id=" + o.bvin);

            switch (o.ShippingStatus)
            {
            case OrderShippingStatus.FullyShipped:
                shipImage = ResolveImgUrl("Lights/ShippingShipped.gif");
                break;

            case OrderShippingStatus.NonShipping:
                shipImage = ResolveImgUrl("Lights/ShippingNone.gif");
                break;

            case OrderShippingStatus.PartiallyShipped:
                shipImage = ResolveImgUrl("Lights/ShippingPartially.gif");
                break;

            case OrderShippingStatus.Unknown:
                shipImage = ResolveImgUrl("Lights/ShippingNone.gif");
                break;

            case OrderShippingStatus.Unshipped:
                shipImage = ResolveImgUrl("Lights/ShippingNone.gif");
                break;
            }
            sb.Append("<a href=\"" + shipLink + "\" title=\"" + shipText + "\"><img src=\"" + shipImage + "\" alt=\"" +
                      shipText + "\" /></a>");

            var statusText = LocalizationUtils.GetOrderStatus(o.StatusName, HccRequestContext.Current.MainContentCulture);
            var statImage  = "";

            switch (o.StatusCode)
            {
            case OrderStatusCode.Completed:
                statImage = ResolveImgUrl("lights/OrderComplete.gif");
                break;

            case OrderStatusCode.Received:
                statImage = ResolveImgUrl("lights/OrderInProcess.gif");
                break;

            case OrderStatusCode.OnHold:
                statImage = ResolveImgUrl("lights/OrderOnHold.gif");
                break;

            case OrderStatusCode.ReadyForPayment:
                statImage = ResolveImgUrl("lights/OrderInProcess.gif");
                break;

            case OrderStatusCode.ReadyForShipping:
                statImage = ResolveImgUrl("lights/OrderInProcess.gif");
                break;

            default:
                statImage = ResolveImgUrl("lights/OrderInProcess.gif");
                break;
            }
            sb.Append("<a href=\"" + url + "\"><img src=\"" + statImage + "\" alt=\"" + statusText +
                      "\" style='margin-right:4px' /></a>");
            sb.Append("<div><a href=\"" + url + "\">" + statusText + "</a></div>");

            return(sb.ToString());
        }
예제 #8
0
        private async void EditNumericAge_Click(object sender,
                                                RoutedEventArgs e)
        {
            var profileStat = sender as UserProfileStat;

            var binding = profileStat?
                          .GetBindingExpression(UserProfileStat.StatValueProperty);

            if (binding == null)
            {
                return;
            }

            var sourceClass =
                (ProfileSchema)binding.ResolvedSource;
            var sourceProperty =
                typeof(ProfileSchema).GetProperty(
                    binding.ResolvedSourcePropertyName);

            if (sourceClass == null || sourceProperty == null)
            {
                return;
            }

            var title = LocalizationUtils
                        .GetLocalized("ProfileEditingTitle");
            var enterName = LocalizationUtils
                            .GetLocalized("EnterTitle");

            var oldValue =
                (int)(sourceProperty.GetValue(sourceClass)
                      ?? 0);
            var value = await DialogManager.ShowNumericDialog(
                title,
                $"{enterName} '{profileStat.StatTitle}'",
                Convert.ToDouble(oldValue),
                0.0,
                255.0,
                1.0,
                "F0")
                        .ConfigureAwait(true);

            if (value == null)
            {
                return;
            }

            sourceProperty.SetValue(
                sourceClass, Convert.ToInt32(value.Value));

            var request = await UserApi.EditProfile(
                SettingsManager.PersistentSettings.CurrentUser.Token,
                ViewModel.CurrentProfileData)
                          .ConfigureAwait(true);

            if (request.IsError)
            {
                await DialogManager.ShowErrorDialog(request.Message)
                .ConfigureAwait(true);

                sourceProperty.SetValue(
                    sourceClass, oldValue);
            }

            var statBlock = profileStat
                            .TryFindParent <StackPanel>();

            if (statBlock == null)
            {
                return;
            }

            UpdateStatBlock(
                statBlock);
        }
예제 #9
0
        private async void RegisterButton_Click(object sender,
                                                RoutedEventArgs e)
        {
            RegisterButton.IsEnabled         = false;
            GoToLoginButton.IsEnabled        = false;
            LoginTextBox.IsEnabled           = false;
            PasswordTextBox.IsEnabled        = false;
            NicknameTextBox.IsEnabled        = false;
            GeneratePasswordButton.IsEnabled = false;

            try
            {
                var nickname = NicknameTextBox.Text;

                if (string.IsNullOrWhiteSpace(nickname))
                {
                    nickname = null;
                }

                var result = await UserApi.Register(
                    LoginTextBox.Text, PasswordTextBox.Password, nickname)
                             .ConfigureAwait(true);

                if (result.IsError)
                {
                    var title = LocalizationUtils
                                .GetLocalized("RegisterErrorTitle");

                    await DialogManager.ShowMessageDialog(
                        title, result.Message)
                    .ConfigureAwait(true);

                    return;
                }

                var setUserSuccess = SettingsManager.PersistentSettings.SetUser(
                    LoginTextBox.Text,
                    result.Data.Token,
                    result.Data.Id,
                    null);

                if (!setUserSuccess)
                {
                    return;
                }

                if (!SettingsManager.PersistentSettings.SetCurrentUser(
                        LoginTextBox.Text))
                {
                    return;
                }


                if (NavigationController.Instance.IsEmptyHistory())
                {
                    NavigationController.Instance.RequestPage <FeedPage>();
                }
                else
                {
                    NavigationController.Instance.GoBack();
                }
            }
            catch (Exception ex)
            {
                await DialogManager.ShowErrorDialog(ex.Message)
                .ConfigureAwait(true);
            }
            finally
            {
                PasswordTextBox.Clear();

                RegisterButton.IsEnabled         = !IsRegisterBlocked();
                GoToLoginButton.IsEnabled        = true;
                LoginTextBox.IsEnabled           = true;
                PasswordTextBox.IsEnabled        = true;
                NicknameTextBox.IsEnabled        = true;
                GeneratePasswordButton.IsEnabled = true;
            }
        }
예제 #10
0
        private async void EditComboBoxSex_Click(object sender,
                                                 RoutedEventArgs e)
        {
            var profileStat = sender as UserProfileStat;

            var binding = profileStat?
                          .GetBindingExpression(UserProfileStat.StatValueProperty);

            if (binding == null)
            {
                return;
            }

            var sourceClass =
                (ProfileSchema)binding.ResolvedSource;
            var sourceProperty =
                typeof(ProfileSchema).GetProperty(
                    binding.ResolvedSourcePropertyName);

            if (sourceClass == null || sourceProperty == null)
            {
                return;
            }

            var title = LocalizationUtils
                        .GetLocalized("ProfileEditingTitle");
            var enterName = LocalizationUtils
                            .GetLocalized("EnterTitle");

            var localizedNames =
                new ReadOnlyCollection <string>(
                    UserSexType.Unknown.GetLocalizedNames());

            var oldValue =
                (UserSexType)(sourceProperty.GetValue(sourceClass)
                              ?? UserSexType.Unknown);
            var valueName = await DialogManager.ShowComboBoxDialog(
                title,
                $"{enterName} '{profileStat.StatTitle}'",
                localizedNames,
                oldValue.GetLocalizedName())
                            .ConfigureAwait(true);

            if (valueName == null)
            {
                return;
            }

            var value = UserSexType.Unknown
                        .ParseLocalizedName(valueName);

            sourceProperty.SetValue(
                sourceClass, value);

            var request = await UserApi.EditProfile(
                SettingsManager.PersistentSettings.CurrentUser.Token,
                ViewModel.CurrentProfileData)
                          .ConfigureAwait(true);

            if (request.IsError)
            {
                await DialogManager.ShowErrorDialog(request.Message)
                .ConfigureAwait(true);

                sourceProperty.SetValue(
                    sourceClass, oldValue);
            }

            var statBlock = profileStat
                            .TryFindParent <StackPanel>();

            if (statBlock == null)
            {
                return;
            }

            UpdateStatBlock(
                statBlock);
        }
예제 #11
0
        private async void EditName_Click(object sender,
                                          RoutedEventArgs e)
        {
            var page = this;

            var binding = page.NicknameTextBox
                          .GetBindingExpression(Emoji.Wpf.TextBlock.TextProperty);

            if (binding == null)
            {
                return;
            }

            var sourceClass =
                (ProfileSchema)binding.ResolvedSource;
            var sourceProperty =
                typeof(ProfileSchema).GetProperty(
                    binding.ResolvedSourcePropertyName);

            if (sourceClass == null || sourceProperty == null)
            {
                return;
            }

            var title = LocalizationUtils
                        .GetLocalized("ProfileEditingTitle");
            var enterName = LocalizationUtils
                            .GetLocalized("EnterTitle");
            var statName = LocalizationUtils
                           .GetLocalized("Nickname");

            var oldValue =
                (string)sourceProperty.GetValue(
                    sourceClass);
            var value = await DialogManager.ShowSinglelineTextDialog(
                title,
                $"{enterName} '{statName}'",
                oldValue)
                        .ConfigureAwait(true);

            if (value == null)
            {
                return;
            }

            sourceProperty.SetValue(
                sourceClass, value);

            var request = await UserApi.EditProfile(
                SettingsManager.PersistentSettings.CurrentUser.Token,
                ViewModel.CurrentProfileData)
                          .ConfigureAwait(true);

            if (request.IsError)
            {
                await DialogManager.ShowErrorDialog(request.Message)
                .ConfigureAwait(true);

                sourceProperty.SetValue(
                    sourceClass, oldValue);

                return;
            }

            ProfileUtils.OnNameChanged(this,
                                       new UserNameChangedEventArgs(oldValue, value, ViewModel.CurrentProfileData.Id));
        }
예제 #12
0
        public async Task UpdateProfile(
            int id)
        {
            await Dispatcher.Invoke(() =>
            {
                return(ShowLoadingGrid());
            }).ConfigureAwait(false);

            try
            {
                Interlocked.Increment(
                    ref _profileUpdateWaitingCount);

                await _profileUpdateLock.WaitAsync()
                .ConfigureAwait(true);
            }
            finally
            {
                Interlocked.Decrement(
                    ref _profileUpdateWaitingCount);
            }

            try
            {
                Dispatcher.Invoke(() =>
                {
                    EditModeButton.IsChecked = false;
                });

                if (id < 0)
                {
                    if (!NavigationController.Instance.IsCurrentContent <UserProfilePage>())
                    {
                        return;
                    }

                    NavigationController.Instance.GoBack(true);

                    var message = LocalizationUtils
                                  .GetLocalized("UserNotFound");

                    await DialogManager.ShowErrorDialog(message)
                    .ConfigureAwait(true);

                    return;
                }

                var result = await UserApi.GetProfileById(
                    id)
                             .ConfigureAwait(true);

                if (result.IsError)
                {
                    if (!NavigationController.Instance.IsCurrentContent <UserProfilePage>())
                    {
                        return;
                    }

                    NavigationController.Instance.GoBack(true);

                    await DialogManager.ShowErrorDialog(result.Message)
                    .ConfigureAwait(true);

                    return;
                }

                if (result.Data == null)
                {
                    if (!NavigationController.Instance.IsCurrentContent <UserProfilePage>())
                    {
                        return;
                    }

                    NavigationController.Instance.GoBack(true);

                    var message = LocalizationUtils
                                  .GetLocalized("UserNotFound");

                    await DialogManager.ShowErrorDialog(message)
                    .ConfigureAwait(true);

                    return;
                }

                Dispatcher.Invoke(() =>
                {
                    ViewModel.CurrentProfileData =
                        result.Data;

                    UpdateStatBlock(StatBlock1, StatBlock2,
                                    StatBlock3, StatBlock4);
                });
            }
            finally
            {
                await Task.Delay(500)
                .ConfigureAwait(true);

                if (_profileUpdateWaitingCount == 0)
                {
                    await Dispatcher.Invoke(() =>
                    {
                        return(HideLoadingGrid());
                    }).ConfigureAwait(false);
                }

                _profileUpdateLock.Release();
            }
        }
        protected void gvItems_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var lineItem = e.Row.DataItem as LineItem;
                if (lineItem == null)
                {
                    return;
                }

                var productLink = GetProductEditLink(lineItem.ProductId, lineItem.ProductSku);

                var lblSKU                       = e.Row.FindControl("lblSKU") as Label;
                var lblDescription               = e.Row.FindControl("lblDescription") as Label;
                var lblShippingStatus            = e.Row.FindControl("lblShippingStatus") as Label;
                var lblAdjustedPrice             = e.Row.FindControl("lblAdjustedPrice") as Label;
                var txtQty                       = e.Row.FindControl("txtQty") as TextBox;
                var lblQty                       = e.Row.FindControl("lblQty") as Label;
                var lblLineTotal                 = e.Row.FindControl("lblLineTotal") as Label;
                var btnDelete                    = e.Row.FindControl("btnDelete") as LinkButton;
                var lblLineTotalWithoutDiscounts = e.Row.FindControl("lblLineTotalWithoutDiscounts") as Label;
                var litDiscounts                 = (Literal)e.Row.FindControl("litDiscounts");
                var divGiftWrap                  = e.Row.FindControl("divGiftWrap") as HtmlGenericControl;
                var litGiftCardsNumbers          = e.Row.FindControl("litGiftCardsNumbers") as Literal;
                var lnkGiftCards                 = e.Row.FindControl("lnkGiftCards") as HyperLink;

                var rvTxtQty = e.Row.FindControl("rvTxtQty") as RangeValidator;
                rvTxtQty.ErrorMessage = Localization.GetString("rvTxtQty.ErrorMessage");

                var lnkInventory = e.Row.FindControl("btnInventory") as LinkButton;
                lnkInventory.Visible = false;
                var product = HccApp.CatalogServices.Products.Find(lineItem.ProductId);
                if (product != null)
                {
                    if (product.InventoryMode != ProductInventoryMode.NotSet && EditMode &&
                        (CurrentOrder.StatusCode == OrderStatusCode.Cancelled ||
                         isPaymentRefunded))
                    {
                        if (product.InventoryMode != ProductInventoryMode.AlwayInStock &&
                            product.InventoryMode != ProductInventoryMode.NotSet)
                        {
                            lnkInventory.Visible = true;
                        }
                    }
                }

                var hdfLineItemId = e.Row.FindControl("hdfLineItemId") as HiddenField;
                hdfLineItemId.Value = lineItem.Id.ToString();

                lblSKU.Text            = string.IsNullOrEmpty(productLink) ? lineItem.ProductSku : productLink;
                lblDescription.Text    = lineItem.ProductName;
                lblDescription.Text   += "<br />" + lineItem.ProductShortDescription;
                lblShippingStatus.Text = LocalizationUtils.GetOrderShippingStatus(lineItem.ShippingStatus);
                lblAdjustedPrice.Text  = lineItem.AdjustedPricePerItem.ToString("C");
                txtQty.Text            = lineItem.Quantity.ToString();
                txtQty.Visible         = EditMode;
                lblQty.Text            = lineItem.Quantity.ToString();
                lblQty.Visible         = !EditMode;
                lblLineTotal.Text      = lineItem.LineTotal.ToString("C");

                if (lineItem.HasAnyDiscounts)
                {
                    lblLineTotalWithoutDiscounts.Visible = true;
                    lblLineTotalWithoutDiscounts.Text    = lineItem.LineTotalWithoutDiscounts.ToString("c");

                    litDiscounts.Text = "<div class=\"discounts\">" + lineItem.DiscountDetailsAsHtml() + "</div>";
                }

                if (!EditMode && !string.IsNullOrEmpty(lineItem.CustomPropGiftCardNumber))
                {
                    divGiftWrap.Visible = true;

                    litGiftCardsNumbers.Text = "Gift Card Number(s): <br/>" + lineItem.CustomPropGiftCardNumber +
                                               "<br/>";

                    lnkGiftCards.Text        = Localization.GetString("GiftCardDetails");
                    lnkGiftCards.NavigateUrl = "/DesktopModules/Hotcakes/Core/Admin/catalog/GiftCards.aspx?lineitem=" +
                                               lineItem.Id;
                }

                btnDelete.CommandArgument = lineItem.Id.ToString();
                btnDelete.Text            = Localization.GetString("Delete");
                btnDelete.OnClientClick   = WebUtils.JsConfirmMessage(Localization.GetJsEncodedString("ConfirmDelete"));
            }
        }
        protected void gvSubscriptions_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var lineItem = e.Row.DataItem as LineItem;
                if (lineItem == null)
                {
                    return;
                }

                var lblSKU                       = e.Row.FindControl("lblSKU") as Label;
                var lblDescription               = e.Row.FindControl("lblDescription") as Label;
                var divGiftWrap                  = e.Row.FindControl("divGiftWrap") as HtmlGenericControl;
                var litGiftCardsNumbers          = e.Row.FindControl("litGiftCardsNumbers") as Literal;
                var lnkGiftCards                 = e.Row.FindControl("lnkGiftCards") as HyperLink;
                var litDiscounts                 = e.Row.FindControl("litDiscounts") as Literal;
                var txtQty                       = e.Row.FindControl("txtQty") as TextBox;
                var lblQty                       = e.Row.FindControl("lblQty") as Label;
                var lblNextPaymentDate           = e.Row.FindControl("lblNextPaymentDate") as Label;
                var lblLineTotalWithoutDiscounts = e.Row.FindControl("lblLineTotalWithoutDiscounts") as Label;
                var lblLineTotal                 = e.Row.FindControl("lblLineTotal") as Label;
                var lblInterval                  = e.Row.FindControl("lblInterval") as Label;
                var lblTotalPayed                = e.Row.FindControl("lblTotalPayed") as Label;
                var btnDelete                    = e.Row.FindControl("btnDelete") as LinkButton;
                var btnCancel                    = e.Row.FindControl("btnCancel") as LinkButton;

                lblSKU.Text          = lineItem.ProductSku;
                lblDescription.Text  = lineItem.ProductName;
                lblDescription.Text += "<br />" + lineItem.ProductShortDescription;
                txtQty.Text          = lineItem.Quantity.ToString();
                txtQty.Visible       = EditMode;
                lblQty.Text          = lineItem.Quantity.ToString();
                lblQty.Visible       = !EditMode;
                if (!lineItem.RecurringBilling.IsCancelled)
                {
                    lblNextPaymentDate.Text = lineItem.RecurringBilling.NextPaymentDate.ToShortDateString();
                }
                else
                {
                    lblNextPaymentDate.Text = Localization.GetString("Cancelled");
                }
                lblLineTotal.Text = lineItem.LineTotal.ToString("C");
                lblInterval.Text  = Localization.GetFormattedString("Every", lineItem.RecurringBilling.Interval,
                                                                    LocalizationUtils.GetRecurringIntervalLower(lineItem.RecurringBilling.IntervalType));
                lblTotalPayed.Text = lineItem.RecurringBilling.TotalPayed.ToString("C");

                if (lineItem.HasAnyDiscounts)
                {
                    lblLineTotalWithoutDiscounts.Visible = true;
                    lblLineTotalWithoutDiscounts.Text    = lineItem.LineTotalWithoutDiscounts.ToString("c");

                    litDiscounts.Text = "<div class=\"discounts\">" + lineItem.DiscountDetailsAsHtml() + "</div>";
                }

                if (!EditMode && !string.IsNullOrEmpty(lineItem.CustomPropGiftCardNumber))
                {
                    divGiftWrap.Visible = true;

                    litGiftCardsNumbers.Text = "Gift Card Number(s): <br/>" + lineItem.CustomPropGiftCardNumber +
                                               "<br/>";

                    lnkGiftCards.Text        = Localization.GetString("GiftCardDetails");
                    lnkGiftCards.NavigateUrl = "/DesktopModules/Hotcakes/Core/Admin/catalog/GiftCards.aspx?lineitem=" +
                                               lineItem.Id;
                }

                btnDelete.Visible         = EditMode;
                btnDelete.CommandArgument = lineItem.Id.ToString();
                btnDelete.OnClientClick   = WebUtils.JsConfirmMessage(Localization.GetJsEncodedString("ConfirmDelete"));

                btnCancel.Visible         = !EditMode && !lineItem.RecurringBilling.IsCancelled;
                btnCancel.CommandArgument = lineItem.Id.ToString();
                btnCancel.OnClientClick   = WebUtils.JsConfirmMessage(Localization.GetJsEncodedString("ConfirmCancel"));
            }
        }