Ejemplo n.º 1
0
        public void Save()
        {
            var configuration = GetSettingsDtoForSave();

            if (configuration == null)
            {
                return;
            }

            using (new SecurityDisabler())
            {
                configuration.Edit(
                    p =>
                {
                    configuration[LastScriptSettingFieldName] = HttpUtility.HtmlEncode(LastScript);
                    ((CheckboxField)configuration.Fields[SaveLastScriptSettingFieldName]).Checked     = SaveLastScript;
                    ((CheckboxField)configuration.Fields[LiveAutocompletionSettingFieldName]).Checked = LiveAutocompletion;
                    configuration[HostWidthSettingFieldName]       = HostWidth.ToString(CultureInfo.InvariantCulture);
                    configuration[ForegroundColorSettingFieldName] = ForegroundColor.ToString();
                    configuration[BackgroundColorSettingFieldName] = BackgroundColor.ToString();
                    configuration[FontSizeSettingFieldName]        = FontSize.ToString();
                    configuration[FontFamilySettingFieldName]      = FontFamily;
                    if (IsPersonalized)
                    {
                        configuration.Fields[FieldIDs.DisplayName].Reset();
                    }
                });
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// persist settings to registry
        /// </summary>
        public void Save()
        {
            // Create or get existing Registry subkey
            RegistryKey key = Registry.CurrentUser.CreateSubKey("SOFTWARE\\todoscreensaver");

            key.SetValue("file", DataPath);
            key.SetValue("close_mode", (int)ScreensaverCloseMode);
            key.SetValue("background_color", BackgroundColor.ToString());
            key.SetValue("foreground_color", ForegroundColor.ToString());
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns a verbose indented string for debugging
 /// </summary>
 /// <returns>a debugging string</returns>
 public override string ToString()
 {
     return
         ("  ForegroundColor: " + ForegroundColor.ToString() + "\n" +
          "  ForegroundRgb: " + (ForegroundRgb == null ? "<null>" : ForegroundRgb.ToString()) + "\n" +
          "  BackgroundColor: " + BackgroundColor.ToString() + "\n" +
          "  BackgroundRgb: " + (BackgroundRgb == null ? "<null>" : BackgroundRgb.ToString()) + "\n" +
          "  Bright: " + Bright.ToString() + "\n" +
          "  Standout: " + Standout.ToString() + "\n" +
          "  Underscore: " + Underscore.ToString() + "\n" +
          "  Blink: " + Blink.ToString() + "\n" +
          "  Reverse: " + Reverse.ToString() + "\n" +
          "  Hidden: " + Hidden.ToString() + "\n" +
          "  Protected: " + Protected.ToString() + "\n"
         );
 }
Ejemplo n.º 4
0
 public void Save(BinaryWriter writer)
 {
     writer.Write(StartDate.ToShortDateString());
     writer.Write(EndDate.ToShortDateString());
     writer.Write(ExceptionList.Count);
     foreach (var shiftTime in ExceptionList)
     {
         shiftTime.Save(writer);
     }
     writer.Write(DaysList.Count);
     foreach (var dayOfWeek in DaysList)
     {
         writer.Write((int)dayOfWeek);
     }
     writer.Write(Name);
     writer.Write(BackgroundColor.ToString());
     writer.Write(ForegroundColor.ToString());
     writer.Write(StartTime.ToShortTimeString());
     writer.Write(Duration.ToString());
 }
Ejemplo n.º 5
0
        public void Save()
        {
            var configuration = GetSettingsDtoForSave();

            if (configuration != null)
            {
                using (new SecurityDisabler())
                {
                    configuration.Edit(
                        p =>
                    {
                        configuration["LastScript"] = HttpUtility.HtmlEncode(LastScript);
                        ((CheckboxField)configuration.Fields["SaveLastScript"]).Checked     = SaveLastScript;
                        ((CheckboxField)configuration.Fields["LiveAutocompletion"]).Checked = LiveAutocompletion;
                        configuration["HostWidth"]       = HostWidth.ToString(CultureInfo.InvariantCulture);
                        configuration["ForegroundColor"] = ForegroundColor.ToString();
                        configuration["BackgroundColor"] = BackgroundColor.ToString();
                        configuration["FontSize"]        = FontSize.ToString();
                        configuration["FontFamily"]      = FontFamily;
                    });
                }
            }
        }
Ejemplo n.º 6
0
        StringBuilder PrepareFormattingString(StringBuilder _formattingString)
        {
            if (!ForegroundColor.IsDefault)
            {
                _formattingString.AppendFormat("color={0} ", ForegroundColor.ToString());
            }

            if (!BackgroundColor.IsDefault)
            {
                _formattingString.AppendFormat("backing_color={0} backing=on ", BackgroundColor.ToString());
            }

            if (!string.IsNullOrEmpty(FontFamily))
            {
                _formattingString.AppendFormat("font={0} ", FontFamily);
            }

            if (FontSize != -1)
            {
                _formattingString.AppendFormat("font_size={0} ", FontSize);
            }

            if ((FontAttributes & FontAttributes.bold) != 0)
            {
                _formattingString.Append("font_weight=Bold ");
            }
            else
            {
                // FontWeight is only available in case of FontAttributes.Bold is not used.
                switch (FontWeight)
                {
                case FontWeight.Bold:
                    _formattingString.Append("font_weight=Bold ");
                    break;

                case FontWeight.SemiBold:
                    _formattingString.Append("font_weight=SemiBold ");
                    break;

                case FontWeight.UltraBold:
                    _formattingString.Append("font_weight=UltraBold ");
                    break;

                case FontWeight.Black:
                    _formattingString.Append("font_weight=Black ");
                    break;

                case FontWeight.ExtraBlack:
                    _formattingString.Append("font_weight=ExtraBlack ");
                    break;

                case FontWeight.Book:
                    _formattingString.Append("font_weight=Book ");
                    break;

                case FontWeight.Light:
                    _formattingString.Append("font_weight=Light ");
                    break;

                case FontWeight.Medium:
                    _formattingString.Append("font_weight=Medium ");
                    break;

                case FontWeight.Normal:
                    _formattingString.Append("font_weight=Normal ");
                    break;

                case FontWeight.Thin:
                    _formattingString.Append("font_weight=Thin ");
                    break;

                case FontWeight.UltraLight:
                    _formattingString.Append("font_weight=UltraLight ");
                    break;
                }
            }

            if ((FontAttributes & FontAttributes.italic) != 0)
            {
                _formattingString.Append("font_style=italic ");
            }

            if (Underline)
            {
                _formattingString.AppendFormat("underline=on underline_color={0} ",
                                               ForegroundColor.IsDefault ? s_defaultLineColor.ToString() : ForegroundColor.ToString());
            }

            if (Strikethrough)
            {
                _formattingString.AppendFormat("strikethrough=on strikethrough_color={0} ",
                                               ForegroundColor.IsDefault ? s_defaultLineColor.ToString() : ForegroundColor.ToString());
            }

            switch (HorizontalTextAlignment)
            {
            case TextAlignment.Auto:
                _formattingString.Append("align=auto ");
                break;

            case TextAlignment.Start:
                _formattingString.Append("align=left ");
                break;

            case TextAlignment.End:
                _formattingString.Append("align=right ");
                break;

            case TextAlignment.Center:
                _formattingString.Append("align=center ");
                break;
            }

            switch (VerticalTextAlignment)
            {
            case TextAlignment.Auto:
            case TextAlignment.Start:
                _formattingString.Append("valign=top ");
                break;

            case TextAlignment.End:
                _formattingString.Append("valign=bottom ");
                break;

            case TextAlignment.Center:
                _formattingString.Append("valign=middle ");
                break;
            }

            switch (LineBreakMode)
            {
            case LineBreakMode.NoWrap:
                _formattingString.Append("wrap=none");
                break;

            case LineBreakMode.CharacterWrap:
                _formattingString.Append("wrap=char");
                break;

            case LineBreakMode.WordWrap:
                _formattingString.Append("wrap=word");
                break;

            case LineBreakMode.MixedWrap:
                _formattingString.Append("wrap=mixed");
                break;

            case LineBreakMode.HeadTruncation:
                _formattingString.Append("ellipsis=0.0");
                break;

            case LineBreakMode.MiddleTruncation:
                _formattingString.Append("ellipsis=0.5");
                break;

            case LineBreakMode.TailTruncation:
                _formattingString.Append("ellipsis=1.0");
                break;
            }

            return(_formattingString);
        }
Ejemplo n.º 7
0
 public override string ToString()
 {
     return($"BackgroundColor: {BackgroundColor.ToString()}, TextColor: {ForegroundColor.ToString()}, Height: {Height}, Width: {Width}");
 }