/// <summary> /// Loads the alternate fonts checkbox list. /// </summary> /// <param name="selectedWeight">The selected weight.</param> private void LoadAlternateFontsCheckboxList(string selectedWeight) { List <FontAwesomeHelper.FontAwesomeIconCssWeight> alternateFontWeights = null; if (FontAwesomeHelper.HasFontAwesomeProKey()) { alternateFontWeights = FontAwesomeHelper.FontAwesomeIconCssWeights.Where(a => a.IsConfigurable && a.WeightName != selectedWeight).ToList(); } else { alternateFontWeights = FontAwesomeHelper.FontAwesomeIconCssWeights.Where(a => a.IsConfigurable && a.IncludedInFree && a.WeightName != selectedWeight).ToList(); } if (alternateFontWeights.Count > 0) { cblFontAwesomeAlternateFonts.Visible = true; var selectedAlternateFonts = cblFontAwesomeAlternateFonts.Items.OfType <ListItem>().Where(a => a.Selected).Select(a => a.Value).ToList(); cblFontAwesomeAlternateFonts.Items.Clear(); foreach (var fontWeight in alternateFontWeights) { cblFontAwesomeAlternateFonts.Items.Add(new ListItem(fontWeight.DisplayName, fontWeight.WeightName) { Selected = selectedAlternateFonts.Contains(fontWeight.WeightName) }); } } else { cblFontAwesomeAlternateFonts.Visible = false; } }
private void SetFloatingButtonGroup() { viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.goi_dien, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf2a0", null, Call_Clicked)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.nhan_tin, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf4ad", null, SendMessage_Clicked)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.chinh_sua, FontAwesomeHelper.GetFont("FontAwesomeRegular"), "\uf044", null, OnEditProduct)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.xoa, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf2ed", null, OnDeleteProduct)); }
public MoreLabel() { //Color.FromHex("#4c4c4c") //Color.FromHex("#6b6a6a") Margin = new Thickness(5); var formattedString = new FormattedString(); formattedString.Spans.Add(new Span { Text = Language.see_all, TextColor = (Color)App.Current.Resources["MainDarkColor"], FontSize = 14, }); formattedString.Spans.Add(new Span { Text = " " }); formattedString.Spans.Add(new Span { Text = "\uf054", TextColor = (Color)App.Current.Resources["MainDarkColor"], FontSize = 12, FontFamily = FontAwesomeHelper.GetFont("FontAwesomeSolid") }); FormattedText = formattedString; TapGestureRecognizer tap = new TapGestureRecognizer(); tap.Tapped += Tap_Tapped; this.GestureRecognizers.Add(tap); }
public async void Init() { this.BindingContext = viewModel = new OwnerPostPageViewModel(); await viewModel.GetOwnerAsync(_id); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.goi_dien, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf2a0", null, CallOptionSelected)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.nhan_tin, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf4ad", null, SendMessageOptionSelected)); }
private void SetFloatingButtonGroup() { bool IsOwner = UserLogged.IsLogged && Guid.Parse(UserLogged.Id) == viewModel.GetPost.UserId; // kiem tra nguoi dang nhap co phai la nguoi tao ra post nay khong. if (IsOwner) { if (viewModel.GetPost.IsCommitment == true) { stThoiGianCamKet.IsVisible = true; } // co cong ty, va chua chia se (= 1 la da duyet, = 2 la gio chung). if (string.IsNullOrEmpty(UserLogged.CompanyId) == false && this.viewModel.GetPost.CompanyStatus != 2 && this.viewModel.GetPost.CompanyStatus != 1) { viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.chia_se_cho_cong_ty, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf14d", null, ShareToCompany)); } viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.thong_tin_chu_so_huu, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf007", null, GoToOwnerPage_Clicked)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.dang_san, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf044", null, Post_ToPostItem)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.chinh_sua, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf044", null, EditPost_Clicked)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.xoa, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf2ed", null, DeletePost_Clicked)); } else { viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.theo_doi_bai_dang, FontAwesomeHelper.GetFont("FontAwesomeRegular"), "\uf004", null, FollowPost_Clicked)); //1 viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.goi_dien, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf2a0", null, CallOptionSelected)); //2 viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.chat, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf4ad", null, ChatOptionSelected)); //3 viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.nhan_tin, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf4ad", null, SendMessageOptionSelected)); //4 viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.dat_lich_hem, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf53c", null, CreateOrder_Clicked)); //5 } }
// bam nut theo doi public async void FollowPost_Clicked(object sender, EventArgs e) { if (!UserLogged.IsLogged) { await DisplayAlert("", Language.vui_long_dang_nhap, Language.dong); RedirectToLoginPage(); return; } loadingPopup.IsVisible = true; if (!this.IsFollow) { var response = await ApiHelper.Post("api/post/AddToFavoritePosts/" + this.viewModel.GetPost.Id, null, true); if (response.IsSuccess) { this.IsFollow = true; INotificationService notificationService = DependencyService.Get <INotificationService>(); var notification = new NotificationModel() { UserId = viewModel.GetPost.UserId, Title = UserLogged.FullName + Language.dang_theo_doi_tin_dang_cua_ban, NotificationType = NotificationType.ViewPost, PostId = viewModel.GetPost.Id, CreatedDate = DateTime.Now, IsRead = false, Thumbnail = viewModel.GetPost.AvatarFullUrl }; await notificationService.AddNotification(notification, Language.theo_doi); } } else { var response = await ApiHelper.Post("api/post/RemoveFromFavoritePosts/" + this.viewModel.GetPost.Id, null, true); if (response.IsSuccess) { this.IsFollow = false; } } if (this.IsFollow) // dang theo doi. { //BtnFollowPost.TextColor = Color.Red; this.viewModel.ButtonCommandList[1].Text = Language.bo_theo_doi_bai_dang; this.viewModel.ButtonCommandList[1].FontFamily = FontAwesomeHelper.GetFont("FontAwesomeSolid"); } else { //BtnFollowPost.TextColor = Color.Red; this.viewModel.ButtonCommandList[1].Text = Language.theo_doi_bai_dang; this.viewModel.ButtonCommandList[1].FontFamily = FontAwesomeHelper.GetFont("FontAwesomeRegular"); } loadingPopup.IsVisible = false; }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack) { var fontAwesomeProKey = FontAwesomeHelper.GetFontAwesomeProKey(); var hasFontAwesomeProKey = FontAwesomeHelper.HasFontAwesomeProKey(); tbFontAwesomeProKey.Text = fontAwesomeProKey; pnlFontAwesomeFree.Visible = !hasFontAwesomeProKey; btnInstallUpdate.Text = hasFontAwesomeProKey ? "Update" : "Install"; fupFontAwesomeProPackage.UploadAsTemporary = true; } }
private void SetFloatingButtonGroup() { if (_isMoiGioi) { btnEdit.IsVisible = true; floatingButtonGroup.IsVisible = false; } else { if (viewModel.ButtonCommandList.Count < 2) { viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.goi_dien, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf2a0", null, Call_Clicked)); viewModel.ButtonCommandList.Add(new FloatButtonItem("Chat", FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf4ad", null, Chat_Clicked)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.nhan_tin, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf4ad", null, SendMessage_Clicked)); } } }
private void SetFloatingButtonGroup() { bool IsOwner = UserLogged.IsLogged && Guid.Parse(UserLogged.Id) == viewModel.FurnitureProduct.CreatedById; // kiem tra nguoi dang nhap co phai la nguoi tao ra post nay khong. if (IsOwner) { viewModel.ButtonCommandList.Insert(0, viewModel.FurnitureProduct.ProductStatus == 0 ? new FloatButtonItem(Language.ngung_ban, FontAwesomeHelper.GetFont("FontAwesomeRegular"), "\uf044", null, OnEditProductStatus) : new FloatButtonItem(Language.dang_ban_status, FontAwesomeHelper.GetFont("FontAwesomeRegular"), "\uf044", null, OnEditProductStatus)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.chinh_sua, FontAwesomeHelper.GetFont("FontAwesomeRegular"), "\uf044", null, OnEditProduct)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.xoa, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf2ed", null, OnDeleteProduct)); } else { viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.thong_tin_ca_nhan, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf129", null, ViewProfile_Clicked)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.goi_dien, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf2a0", null, Call_Clicked)); viewModel.ButtonCommandList.Add(new FloatButtonItem("Chat", FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf4ad", null, Chat_Clicked)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.nhan_tin, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf4ad", null, SendMessage_Clicked)); } }
private void SetFloatingButtonGroup() { bool IsOwner = UserLogged.IsLogged && Guid.Parse(UserLogged.Id) == viewModel.LiquidationToDay.CreatedById; // kiem tra nguoi dang nhap co phai la nguoi tao ra post nay khong. if (IsOwner) { viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.chinh_sua, FontAwesomeHelper.GetFont("FontAwesomeRegular"), "\uf044", null, OnEditProduct)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.xoa, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf2ed", null, Delete_Clicked)); } else { viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.thong_tin_ca_nhan, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf129", null, ViewProfile_Clicked)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.goi_dien, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf2a0", null, Call_Clicked)); viewModel.ButtonCommandList.Add(new FloatButtonItem("Chat", FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf4ad", null, Chat_Clicked)); viewModel.ButtonCommandList.Add(new FloatButtonItem(Language.nhan_tin, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf4ad", null, SendMessage_Clicked)); btnOrder.IsVisible = true; } }
/// <summary> /// Handles the Click event of the btnInstallUpdate control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnInstallUpdate_Click(object sender, EventArgs e) { var fontAwesomeProKey = FontAwesomeHelper.GetFontAwesomeProKey(); List <string> updateMessages = new List <string>(); if (fontAwesomeProKey != tbFontAwesomeProKey.Text) { FontAwesomeHelper.SetFontAwesomeProKey(tbFontAwesomeProKey.Text); if (tbFontAwesomeProKey.Text.IsNullOrWhiteSpace()) { updateMessages.Add("Font Awesome Pro Key removed"); pnlFontAwesomeFree.Visible = true; } else { updateMessages.Add("Font Awesome Pro Key updated"); pnlFontAwesomeFree.Visible = false; } } if (fupFontAwesomeProPackage.BinaryFileId.HasValue) { if (FontAwesomeHelper.ExtractFontAwesomePackage(fupFontAwesomeProPackage.BinaryFileId.Value)) { updateMessages.Add("Font Awesome Pro Package updated. In order to use any new fonts you must manually re-compile the theme where they will be used"); btnInstallUpdate.Text = "Update"; } } if (updateMessages.Any()) { nbInstallSuccess.Text = updateMessages.AsDelimited(", ", " and ") + "."; nbInstallSuccess.NotificationBoxType = NotificationBoxType.Success; nbInstallSuccess.Visible = true; } else { nbInstallSuccess.Text = "Please upload a Font Awesome Pro Package to update the Font Awesome fonts"; nbInstallSuccess.NotificationBoxType = NotificationBoxType.Warning; nbInstallSuccess.Visible = true; } }
/// <summary> /// Loads the drop downs. /// </summary> private void LoadDropDowns() { ddlFontAwesomeIconWeight.Items.Clear(); if (FontAwesomeHelper.HasFontAwesomeProKey()) { // If they have pro, any of the weights can be used as the primary weight foreach (var fontAwesomeIconCssWeight in FontAwesomeHelper.FontAwesomeIconCssWeights.Where(a => a.IsConfigurable)) { ddlFontAwesomeIconWeight.Items.Add(new ListItem(fontAwesomeIconCssWeight.DisplayName, fontAwesomeIconCssWeight.WeightName)); } } else { // If they don't have pro, include list the weights that are included in the free version, and are allowed to be used a primary weight foreach (var fontAwesomeIconCssWeight in FontAwesomeHelper.FontAwesomeIconCssWeights.Where(a => a.IsConfigurable && a.IncludedInFree && !a.RequiresProForPrimary)) { ddlFontAwesomeIconWeight.Items.Add(new ListItem(fontAwesomeIconCssWeight.DisplayName, fontAwesomeIconCssWeight.WeightName)); } } }
public async void Init() { await SetForm(); if (_goiVay == null) { return; } var ButtonCommandList = new List <FloatButtonItem>(); if (UserLogged.IsLogged && _goiVay.EmployeeId == Guid.Parse(UserLogged.Id)) { ButtonCommandList.Add(new FloatButtonItem(Language.chinh_sua, FontAwesomeHelper.GetFont("FontAwesomeRegular"), "\uf044", null, async(sender, e) => { var view = new AddLoanView(bottomModal, _id); view.OnCancel += async(sender1, e1) => await ModalAddLoan.Hide(); view.OnSaved += async(sender1, e1) => { loadingPopup.IsVisible = true; await ModalAddLoan.Hide(); await SetForm(); loadingPopup.IsVisible = false; }; ModalAddLoan.Body = view; await ModalAddLoan.Show(); })); ButtonCommandList.Add(new FloatButtonItem(Language.xoa, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf2ed", null, Remove_Clicked)); } else { ButtonCommandList.Add(new FloatButtonItem(Language.goi_dien, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf2a0", null, CallOptionSelected)); //2 ButtonCommandList.Add(new FloatButtonItem(Language.chat, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf4ad", null, ChatOptionSelected)); //3 ButtonCommandList.Add(new FloatButtonItem(Language.nhan_tin, FontAwesomeHelper.GetFont("FontAwesomeSolid"), "\uf4ad", null, SendMessageOptionSelected)); //4 } floatingButtonGroup.ItemsSource = ButtonCommandList; loadingPopup.IsVisible = false; }
public async Task ChekcIsFollowPost() { if (UserLogged.IsLogged) { var response = await ApiHelper.Get <object>("api/post/IsFollowPost/" + viewModel.GetPost.Id, true); if (response.IsSuccess) { this.IsFollow = (bool)response.Content; if (this.IsFollow) // dang theo doi. { //BtnFollowPost.TextColor = Color.Red; this.viewModel.ButtonCommandList[1].Text = Language.bo_theo_doi_bai_dang; this.viewModel.ButtonCommandList[1].FontFamily = FontAwesomeHelper.GetFont("FontAwesomeSolid"); } else { //BtnFollowPost.TextColor = Color.Gray; } } } }
private async void OnEditProductStatus(object sender, EventArgs e) { if (UserLogged.Id == viewModel.FurnitureProduct.CreatedById.ToString()) { var response = await ApiHelper.Put($"{ApiRouter.FURNITUREPRODUCT_UPDATE_PRODUCT_STATUS}/{viewModel.FurnitureProduct.Id}?status={(viewModel.FurnitureProduct.ProductStatus == 0 ? 1 : 0)}", viewModel.FurnitureProduct, true); if (response.IsSuccess) { viewModel.FurnitureProduct.ProductStatus = viewModel.FurnitureProduct.ProductStatus == 0 ? 1 : 0; viewModel.ButtonCommandList.RemoveAt(0); viewModel.ButtonCommandList.Insert(0, viewModel.FurnitureProduct.ProductStatus == 0 ? new FloatButtonItem(Language.ngung_ban, FontAwesomeHelper.GetFont("FontAwesomeRegular"), "\uf044", null, OnEditProductStatus) : new FloatButtonItem(Language.dang_ban_status, FontAwesomeHelper.GetFont("FontAwesomeRegular"), "\uf044", null, OnEditProductStatus)); viewModel.fireonchange(); //MessagingCenter.Send<ProductDetailPageViewModel, Guid>(this, "DeleteProduct", productId); MessagingCenter.Send <ProductDetailPage, Guid>(this, "UpdateProductStatus", viewModel.FurnitureProduct.Id); ToastMessageHelper.ShortMessage(Language.cap_nhat_thanh_cong); } else { ToastMessageHelper.ShortMessage(Language.cap_nhat_that_bai); } } }
/// <summary> /// Handles the Click event of the btnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnSave_Click(object sender, EventArgs e) { string cssOverrideFile = string.Format(@"{0}Themes/{1}/Styles/_css-overrides.less", Request.PhysicalApplicationPath, _themeName); if (File.Exists(cssOverrideFile)) { File.WriteAllText(cssOverrideFile, ceOverrides.Text); } // get list of original values Dictionary <string, string> originalValues = GetVariables(_variableFile); StringBuilder overrideFile = new StringBuilder(); if (pnlFontAwesomeSettings.Visible) { overrideFile.AppendLine(FontAwesomeHelper.VariableOverridesTokens.StartRegion); var selectedPrimaryWeight = FontAwesomeHelper.FontAwesomeIconCssWeights.FirstOrDefault(a => a.WeightName == ddlFontAwesomeIconWeight.SelectedValue); overrideFile.AppendLine(string.Format("{0} {1};", FontAwesomeHelper.VariableOverridesTokens.FontWeightValueLineStart, selectedPrimaryWeight.WeightValue)); overrideFile.AppendLine(string.Format("{0} '{1}';", FontAwesomeHelper.VariableOverridesTokens.FontWeightNameLineStart, selectedPrimaryWeight.WeightName)); if (FontAwesomeHelper.HasFontAwesomeProKey()) { overrideFile.AppendLine("@fa-edition: 'pro';"); } overrideFile.AppendLine(); if (!selectedPrimaryWeight.IncludedInFree) { overrideFile.AppendLine(string.Format("{0} {1};", FontAwesomeHelper.VariableOverridesTokens.FontEditionLineStart, FontAwesomeHelper.VariableOverridesTokens.FontEditionPro)); } overrideFile.AppendLine("@import \"../../../Styles/FontAwesome/_rock-fa-mixins.less\";"); foreach (var alternateFontWeightName in cblFontAwesomeAlternateFonts.Items.OfType <ListItem>().Where(a => a.Selected).Select(a => a.Value).ToList()) { var alternateFont = FontAwesomeHelper.FontAwesomeIconCssWeights.Where(a => a.WeightName == alternateFontWeightName).FirstOrDefault(); if (alternateFont != null) { string suffixParam = string.Empty; overrideFile.AppendLine( string.Format("{0} '{1}', 'pro' );", FontAwesomeHelper.VariableOverridesTokens.FontFaceLineStart, alternateFont.WeightName )); } } overrideFile.AppendLine(FontAwesomeHelper.VariableOverridesTokens.EndRegion); } foreach (var control in phThemeControls.Controls) { if (control is TextBox) { var textBoxControl = ( TextBox )control; string variableName = textBoxControl.ID.Replace(" ", "-").ToLower(); // find original value if (originalValues.ContainsKey(variableName)) { string originalValue = originalValues[variableName]; // color picker will convert #fff to #ffffff so take that into account string secondaryValue = string.Empty; if (originalValue.Length == 4 && originalValue[0] == '#') { secondaryValue = originalValue + originalValue.Substring(1, 3); } if (originalValue.ToLower() != textBoxControl.Text.ToLower() && secondaryValue.ToLower() != textBoxControl.Text.ToLower()) { overrideFile.Append(string.Format("@{0}: {1};{2}", variableName, textBoxControl.Text, Environment.NewLine)); } } } } File.WriteAllText(_variableOverrideFile, overrideFile.ToString()); // compile theme string messages = string.Empty; var theme = new RockTheme(_themeName); if (!theme.Compile(out messages)) { nbMessages.NotificationBoxType = NotificationBoxType.Danger; nbMessages.Text = string.Format("An error occurred while compiling the {0} theme.\nMessage: <pre>{1}</pre>", theme.Name, messages);; nbMessages.Visible = true; } else { NavigateToParentPage(); } }