internal WndFontChooser(PNFont font, Color color) : this() { _SelectedFont.FontFamily = font.FontFamily; _SelectedFont.FontSize = font.FontSize; _SelectedFont.FontStretch = font.FontStretch; _SelectedFont.FontStyle = font.FontStyle; _SelectedFont.FontWeight = font.FontWeight; _SelectedColor = color; }
internal WndFontChooser(PNFont font) : this() { _SelectedFont.FontFamily = font.FontFamily; _SelectedFont.FontSize = font.FontSize; _SelectedFont.FontStretch = font.FontStretch; _SelectedFont.FontStyle = font.FontStyle; _SelectedFont.FontWeight = font.FontWeight; grpColors.Visibility = Visibility.Collapsed; }
private void cmdRestoreFontUI_Click(object sender, RoutedEventArgs e) { try { var f = new PNFont(); PNSingleton.Instance.FontUser.FontFamily = f.FontFamily; PNSingleton.Instance.FontUser.FontSize = f.FontSize; PNSingleton.Instance.FontUser.FontStretch = f.FontStretch; PNSingleton.Instance.FontUser.FontStyle = f.FontStyle; PNSingleton.Instance.FontUser.FontWeight = f.FontWeight; PNData.SaveFontUi(); cmdRestoreFontUI.IsEnabled = false; } catch (Exception ex) { PNStatic.LogException(ex); } }
public void SetPNFont(PNFont font) { this.SetFont(font); }
private void DlgSettings_Loaded(object sender, RoutedEventArgs e) { try { PNStatic.FormSettings = this; prepareLists(); initializeComboBoxes(); var f = new PNFont(); cmdRestoreFontUI.IsEnabled = f != PNSingleton.Instance.FontUser; applyFirstTimeLanguage(); //applyLanguage(); PNStatic.FormMain.LanguageChanged += FormMain_LanguageChanged; _TempSettings = PNStatic.Settings.PNClone(); _SyncComps = PNStatic.SyncComps.PNClone(); _Groups = PNStatic.ContactGroups.PNClone(); _Contacts = PNStatic.Contacts.PNClone(); _Externals = PNStatic.Externals.PNClone(); _SProviders = PNStatic.SearchProviders.PNClone(); _SmtpClients = PNStatic.SmtpProfiles.PNClone(); _MailContacts = PNStatic.MailContacts.PNClone(); _Tags = PNStatic.Tags.PNClone(); _TempDocking = (PNGroup)PNStatic.Docking.Clone(); _SocialPlugins = PNStatic.PostPlugins.PNClone(); _SyncPlugins = PNStatic.SyncPlugins.PNClone(); initPageGeneral(true); initPageSchedule(true); initPageAppearance(true); initPageBehavior(true); initPageNetwork(true); initPageProtection(true); _TimerConnections.Elapsed += _TimerConnections_Elapsed; if (_TempSettings.Network.EnableExchange) _TimerConnections.Start(); _Loaded = true; } catch (Exception ex) { PNStatic.LogException(ex); } }
internal static void InsertDefaultGroup(int id, int parentID, string name, BitmapImage image, ImageFormat imageFormat) { try { var c = new ColorConverter(); var wpfFontConverter = new WPFFontConverter(); var sb = new StringBuilder(); sb.Append("INSERT INTO GROUPS (GROUP_ID, PARENT_ID, GROUP_NAME, ICON, BACK_COLOR, CAPTION_FONT_COLOR, CAPTION_FONT, SKIN_NAME, PASSWORD_STRING, IS_DEFAULT_IMAGE) VALUES("); sb.Append(id); sb.Append(","); sb.Append(parentID); sb.Append(",'"); sb.Append(name.Replace("'", "''")); sb.Append("','"); var base64String = Convert.ToBase64String(image.ToBytes()); sb.Append(base64String); //using (var ms = new MemoryStream(1)) //{ // image.Save(ms, imageFormat); // ms.Position = 0; // string base64String = Convert.ToBase64String(ms.ToArray()); // sb.Append(base64String); //} sb.Append("','"); sb.Append(c.ConvertToString(null, PNStatic.CultureInvariant, PNSkinlessDetails.DefColor)); sb.Append("','"); sb.Append(c.ConvertToString(null, PNStatic.CultureInvariant, SystemColors.ControlTextColor)); sb.Append("','"); var f = new PNFont { FontWeight = FontWeights.Bold }; sb.Append(wpfFontConverter.ConvertToString(f)); sb.Append("','"); sb.Append(PNSkinDetails.NO_SKIN); sb.Append("','',1"); sb.Append("); "); ExecuteTransactionForStringBuilder(sb, ConnectionString); } catch (Exception ex) { PNStatic.LogException(ex); } }
private string prepareGroupInsert(int id, int parentID, string name, string imageName) { try { var c = new ColorConverter(); var lfc = new WPFFontConverter(); var sb = new StringBuilder(); sb.Append("INSERT INTO GROUPS (GROUP_ID, PARENT_ID, GROUP_NAME, ICON, BACK_COLOR, CAPTION_FONT_COLOR, CAPTION_FONT, SKIN_NAME, PASSWORD_STRING, IS_DEFAULT_IMAGE) VALUES("); sb.Append(id); sb.Append(","); sb.Append(parentID); sb.Append(",'"); sb.Append(name.Replace("'", "''")); sb.Append("','"); //sb.Append(PNStrings.RESOURCE_PREFIX); sb.Append(imageName); sb.Append("','"); sb.Append(c.ConvertToString(null, PNStatic.CultureInvariant, PNSkinlessDetails.DefColor)); sb.Append("','"); sb.Append(c.ConvertToString(null, PNStatic.CultureInvariant, SystemColors.ControlTextColor)); sb.Append("','"); var f = new PNFont { FontWeight = FontWeights.Bold }; sb.Append(lfc.ConvertToString(f)); sb.Append("','"); sb.Append(PNSkinDetails.NO_SKIN); sb.Append("','',1"); sb.Append("); "); return sb.ToString(); } catch (Exception ex) { PNStatic.LogException(ex); return ""; } }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var s = value as string; if (s == null) return base.ConvertFrom(context, culture, value); var v = s.Split(','); var wpf = new PNFont { FontFamily = new FontFamily(v[0]), FontSize = double.Parse(v[1], CultureInfo.InvariantCulture) }; switch (v[2]) { case "Oblique": wpf.FontStyle = FontStyles.Oblique; break; case "Italic": wpf.FontStyle = FontStyles.Italic; break; default: wpf.FontStyle = FontStyles.Normal; break; } switch (v[3]) { case "Black": wpf.FontWeight = FontWeights.Black; break; case "Bold": wpf.FontWeight = FontWeights.Bold; break; case "DemiBold": wpf.FontWeight = FontWeights.DemiBold; break; case "ExtraBlack": wpf.FontWeight = FontWeights.ExtraBlack; break; case "ExtraBold": wpf.FontWeight = FontWeights.ExtraBold; break; case "ExtraLight": wpf.FontWeight = FontWeights.ExtraLight; break; case "Heavy": wpf.FontWeight = FontWeights.Heavy; break; case "Light": wpf.FontWeight = FontWeights.Light; break; case "Medium": wpf.FontWeight = FontWeights.Medium; break; case "Regular": wpf.FontWeight = FontWeights.Regular; break; case "SemiBold": wpf.FontWeight = FontWeights.SemiBold; break; case "Thin": wpf.FontWeight = FontWeights.Thin; break; case "UltraBlack": wpf.FontWeight = FontWeights.UltraBlack; break; case "UltraBold": wpf.FontWeight = FontWeights.UltraBold; break; case "UltraLight": wpf.FontWeight = FontWeights.UltraLight; break; default: wpf.FontWeight = FontWeights.Normal; break; } switch (v[4]) { case "Condensed": wpf.FontStretch = FontStretches.Condensed; break; case "Expanded": wpf.FontStretch = FontStretches.Expanded; break; case "ExtraCondensed": wpf.FontStretch = FontStretches.ExtraCondensed; break; case "ExtraExpanded": wpf.FontStretch = FontStretches.ExtraExpanded; break; case "Medium": wpf.FontStretch = FontStretches.Medium; break; case "SemiCondensed": wpf.FontStretch = FontStretches.SemiCondensed; break; case "SemiExpanded": wpf.FontStretch = FontStretches.SemiExpanded; break; case "UltraCondensed": wpf.FontStretch = FontStretches.UltraCondensed; break; case "UltraExpanded": wpf.FontStretch = FontStretches.UltraExpanded; break; default: wpf.FontStretch = FontStretches.Normal; break; } return wpf; }
public void SetPNFont(PNFont font) { //do nothing }
public bool Equals(PNFont pf) { if (pf == null) return false; return (Equals(_FontFamily, pf._FontFamily) && Math.Abs(_FontSize - pf._FontSize) < double.Epsilon && _FontStretch == pf._FontStretch && _FontStyle == pf._FontStyle && _FontWeight == pf._FontWeight); }