Exemplo n.º 1
0
 public void LoadFrom(ToolEnvironment toolEnvironment)
 {
     this.textAlignment            = toolEnvironment.textAlignment;
     this.gradientInfo             = toolEnvironment.gradientInfo.Clone();
     this.fontSmoothing            = toolEnvironment.fontSmoothing;
     this.fontInfo                 = toolEnvironment.fontInfo.Clone();
     this.penInfo                  = toolEnvironment.penInfo.Clone();
     this.brushInfo                = toolEnvironment.brushInfo.Clone();
     this.primaryColor             = toolEnvironment.primaryColor;
     this.secondaryColor           = toolEnvironment.secondaryColor;
     this.alphaBlending            = toolEnvironment.alphaBlending;
     this.shapeDrawType            = toolEnvironment.shapeDrawType;
     this.antiAliasing             = toolEnvironment.antiAliasing;
     this.colorPickerClickBehavior = toolEnvironment.colorPickerClickBehavior;
     this.resamplingAlgorithm      = toolEnvironment.resamplingAlgorithm;
     this.tolerance                = toolEnvironment.tolerance;
     this.selectionCombineMode     = toolEnvironment.selectionCombineMode;
     this.floodMode                = toolEnvironment.floodMode;
     this.selectionDrawModeInfo    = toolEnvironment.selectionDrawModeInfo.Clone();
     PerformAllChanged();
 }
Exemplo n.º 2
0
        public static ToolEnvironment GetDefaultAppEnvironment()
        {
            ToolEnvironment toolEnvironment;

            try
            {
                string defaultAppEnvBase64 = Settings.CurrentUser.GetString("DefaultAppEnvironment", null);

                if (defaultAppEnvBase64 == null)
                {
                    toolEnvironment = null;
                }
                else
                {
                    byte[]          defaultAppEnvBytes = System.Convert.FromBase64String(defaultAppEnvBase64);
                    BinaryFormatter formatter          = new BinaryFormatter();

                    using (MemoryStream stream = new MemoryStream(defaultAppEnvBytes, false))
                    {
                        object defaultAppEnvObject = formatter.Deserialize(stream);
                        toolEnvironment = (ToolEnvironment)defaultAppEnvObject;
                    }
                }
            }

            catch (Exception)
            {
                toolEnvironment = null;
            }

            if (toolEnvironment == null)
            {
                toolEnvironment = new ToolEnvironment();
                toolEnvironment.SetToDefaults();
            }

            return(toolEnvironment);
        }
Exemplo n.º 3
0
 private void InitializeSetting()
 {
     ToolEnvironment = ToolEnvironment.GetDefaultAppEnvironment();
 }