コード例 #1
0
 public InteractableAnimatorTheme()
 {
     Types = new Type[] { typeof(Transform) };
     Name  = "AnimatorTheme";
     ThemeProperties.Add(
         new InteractableThemeProperty()
     {
         Name    = "Animator Trigger",
         Type    = InteractableThemePropertyValueTypes.AnimatorTrigger,
         Values  = new List <InteractableThemePropertyValue>(),
         Default = new InteractableThemePropertyValue()
         {
             String = "Default"
         }
     });
 }
コード例 #2
0
 public InteractableShaderTheme()
 {
     Types = new Type[] { typeof(Renderer) };
     Name  = "Shader Float";
     ThemeProperties.Add(
         new InteractableThemeProperty()
     {
         Name    = "Shader",
         Type    = InteractableThemePropertyValueTypes.ShaderFloat,
         Values  = new List <InteractableThemePropertyValue>(),
         Default = new InteractableThemePropertyValue()
         {
             Float = 0
         }
     });
 }
コード例 #3
0
 public InteractableRotationTheme()
 {
     Types = new Type[] { typeof(Transform) };
     Name  = "Rotation Theme";
     ThemeProperties.Add(
         new InteractableThemeProperty()
     {
         Name    = "Rotation",
         Type    = InteractableThemePropertyValueTypes.Vector3,
         Values  = new List <InteractableThemePropertyValue>(),
         Default = new InteractableThemePropertyValue()
         {
             Vector3 = Vector3.zero
         }
     });
 }
コード例 #4
0
 public InteractableMaterialTheme()
 {
     Types    = new Type[] { typeof(Renderer) };
     Name     = "Material Theme";
     NoEasing = true;
     ThemeProperties.Add(
         new InteractableThemeProperty()
     {
         Name    = "Material",
         Type    = InteractableThemePropertyValueTypes.Material,
         Values  = new List <InteractableThemePropertyValue>(),
         Default = new InteractableThemePropertyValue()
         {
             Material = null
         }
     });
 }
コード例 #5
0
 public InteractableActivateTheme()
 {
     Types    = new Type[] { typeof(Transform) };
     Name     = "Activate Theme";
     NoEasing = true;
     ThemeProperties.Add(
         new InteractableThemeProperty()
     {
         Name    = "Activate",
         Type    = InteractableThemePropertyValueTypes.Bool,
         Values  = new List <InteractableThemePropertyValue>(),
         Default = new InteractableThemePropertyValue()
         {
             Bool = true
         }
     });
 }
コード例 #6
0
 public InteractableAudioTheme()
 {
     Types    = new Type[] { typeof(Transform) };
     Name     = "Audio Theme";
     NoEasing = true;
     ThemeProperties.Add(
         new InteractableThemeProperty()
     {
         Name    = "Audio",
         Type    = InteractableThemePropertyValueTypes.AudioClip,
         Values  = new List <InteractableThemePropertyValue>(),
         Default = new InteractableThemePropertyValue()
         {
             AudioClip = null
         }
     });
 }
コード例 #7
0
 public InteractableTextureTheme()
 {
     Types    = new Type[] { typeof(Renderer) };
     Name     = "Texture Theme";
     NoEasing = true;
     ThemeProperties.Add(
         new InteractableThemeProperty()
     {
         Name    = "Texture",
         Type    = InteractableThemePropertyValueTypes.Texture,
         Values  = new List <InteractableThemePropertyValue>(),
         Default = new InteractableThemePropertyValue()
         {
             Texture = null
         }
     });
 }
コード例 #8
0
 public InteractableStringTheme()
 {
     Types    = new Type[] { typeof(TextMesh), typeof(Text) };
     Name     = "String Theme";
     NoEasing = true;
     ThemeProperties.Add(
         new InteractableThemeProperty()
     {
         Name    = "String",
         Type    = InteractableThemePropertyValueTypes.String,
         Values  = new List <InteractableThemePropertyValue>(),
         Default = new InteractableThemePropertyValue()
         {
             String = ""
         }
     });
 }
コード例 #9
0
        public string ThemeChange(ThemeProperties color)
        {
            var    sourcepath    = "";
            string changes       = "";
            var    propertieskey = (color.properties.Keys);
            string timeStamp     = "";

            timeStamp = GetTimestamp(DateTime.Now);
            string[] keys = (propertieskey as IEnumerable).Cast <object>().Select(x => x.ToString()).ToArray();
            for (var i = 0; i < keys.Length; i++)
            {
                string value = color.properties[keys[i]];
                changes = changes + (keys[i] + ":" + value) + ";\n";
            }

            string theme        = (color.GetType().GetProperty("theme").GetValue(color, null)) as string;
            string basePath     = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
            var    path         = basePath + "ej2-resource/styles/";
            var    templatepath = basePath + "template/";
            string templatefile = System.IO.File.ReadAllText(templatepath + theme + ".txt");

            templatefile = templatefile.Replace("{{:common}}", changes as string);
            string filecontent = "";

            filecontent = filecontent + templatefile;
            filecontent = filecontent + System.IO.File.ReadAllText(path + "/all" + theme + ".scss");
            var    outputdir    = basePath + "resource/styles/";
            string ScssFilePath = outputdir + timeStamp;

            System.IO.Directory.CreateDirectory(ScssFilePath);
            sourcepath = ScssFilePath + "/" + theme + ".scss";

            System.IO.File.WriteAllText(sourcepath, filecontent);

            string result = sasscompiler(sourcepath);

            //delete all existing files and directories.
            sourcepath = ScssFilePath + "/" + theme + ".css";
            System.IO.File.WriteAllText(sourcepath, result);
            if (Directory.Exists(outputdir))
            {
                Directory.Delete(outputdir, true);
            }

            return(result);
        }
コード例 #10
0
        public string export(ThemeProperties exporting)
        {
            String timeStamp  = "";
            var    sourcepath = "";
            var    bytes      = new byte[4];
            var    rng        = System.Security.Cryptography.RandomNumberGenerator.Create();

            rng.GetBytes(bytes);
            uint   random        = BitConverter.ToUInt32(bytes, 0) % 100000000;
            string str           = String.Format("{0:D8}", random);
            var    propertieskey = (exporting.properties.Keys);
            string changes       = "";
            string theme         = (exporting.GetType().GetProperty("theme").GetValue(exporting, null)) as string;

            string[] keys = (propertieskey as IEnumerable).Cast <object>().Select(x => x.ToString()).ToArray();
            for (var i = 0; i < keys.Length; i++)
            {
                string value = exporting.properties[keys[i]];
                changes = changes + (keys[i] + ":" + value) + ";\n";
            }
            string filecontents = "";
            string basePath     = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
            var    path         = basePath + "ej2-resource/styles/";
            var    templatepath = basePath + "template/";
            string templatefile = System.IO.File.ReadAllText(templatepath + theme + ".txt");

            templatefile = templatefile.Replace("{{:common}}", changes as string);
            var components = (exporting.GetType().GetProperty("components").GetValue(exporting, null));

            string[] componentsarray = (components as IEnumerable).Cast <object>().Select(x => x.ToString()).ToArray();



            /* json file content*/
            dynamic settings = new JObject();

            settings.theme         = theme;
            settings["properties"] = JsonConvert.SerializeObject(exporting.properties);
            settings["components"] = JsonConvert.SerializeObject(componentsarray);

            /* json file end */
            var foldername = (exporting.GetType().GetProperty("file").GetValue(exporting, null)) as string; // user declare download floder name

            filecontents = filecontents + templatefile;
            var depen = (exporting.GetType().GetProperty("dependency").GetValue(exporting, null));

            string[] deps = (depen as IEnumerable).Cast <object>().Select(x => x.ToString()).ToArray();
            /* read a sass file */
            for (int i = 0; i < deps.Length; i++)
            {
                if (deps[i] == "base")
                {
                    path         = path + deps[i] + "/" + theme + ".scss";
                    filecontents = filecontents + System.IO.File.ReadAllText(path);
                }
                else
                {
                    String   searchfilename    = theme + ".scss";
                    String   sourcedirectories = basePath + "ej2-resource/styles/" + deps[i] + "/";
                    String[] files             = Directory.GetFiles(sourcedirectories, searchfilename, SearchOption.AllDirectories);
                    foreach (String file in files)
                    {
                        filecontents = filecontents + System.IO.File.ReadAllText(file);
                    }
                }
            }

            timeStamp = GetTimestamp(DateTime.Now); // timestamp creation
            //timeStamp = "checking";
            string compatiblity = (exporting.GetType().GetProperty("compatiblity").GetValue(exporting, null)) as string;
            string outputdir    = basePath + "outputs/" + foldername + '-' + timeStamp + '-' + str + "/";

            System.IO.Directory.CreateDirectory(outputdir);
            System.IO.File.WriteAllText(outputdir + theme + ".scss", filecontents);
            sourcepath = outputdir + theme + ".scss";
            string result = sasscompiler(sourcepath);

            /* compatibility css */
            if (compatiblity == "True")
            {
                string compataibilitydir = basePath + "outputs/" + foldername + '-' + timeStamp + '-' + str + "/compatibility/";
                System.IO.Directory.CreateDirectory(compataibilitydir);
                filecontents = filecontents.Replace("#{&}", ".e-control");
                System.IO.File.WriteAllText(compataibilitydir + theme + ".scss", "$css: '.e-css' !default;\n$imported-modules: () !default;\n" + filecontents + "\n .e-control .e-js [class^='e-'], .e-control .e-js [class*=' e-'] {\n  box-sizing: content-box;\n }");
                sourcepath = compataibilitydir + theme + ".scss";
                string comptibilityresult = sasscompiler(sourcepath);
                System.IO.File.WriteAllText(compataibilitydir + theme + ".css", comptibilityresult);
            }

            /* creation zip file */
            string zipPath   = basePath + "outputzip";
            string zipTarget = zipPath + "/" + foldername + '-' + timeStamp + '-' + str + ".zip";
            string outputzip = "outputzip/" + foldername + '-' + timeStamp + '-' + str + ".zip";

            System.IO.File.WriteAllText(outputdir + theme + ".css", result);
            System.IO.File.WriteAllText(outputdir + theme + ".scss", filecontents);
            string settingsJson = JsonConvert.SerializeObject(settings);

            System.IO.File.WriteAllText(outputdir + "settings.json", settingsJson);
            System.IO.Directory.CreateDirectory(zipPath);
            ZipFile.CreateFromDirectory(outputdir, zipTarget);
            if (Directory.Exists(outputdir))
            {
                Directory.Delete(outputdir, true);
            }

            return(outputzip);
        }
コード例 #11
0
 public ThemePropertiesWrapper(ThemeProperties model) : base(model)
 {
 }
コード例 #12
0
        public string DarkThemeChange(ThemeProperties color)
        {
            var    sourcepath    = "";
            string changes       = "";
            var    propertieskey = (color.properties.Keys);

            string[] keys = (propertieskey as IEnumerable).Cast <object>().Select(x => x.ToString()).ToArray();
            for (var i = 0; i < keys.Length; i++)
            {
                string value = color.properties[keys[i]];
                changes = changes + (keys[i] + ":" + value) + ";\n";
            }

            string theme    = (color.GetType().GetProperty("theme").GetValue(color, null)) as string;
            string basePath = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
            var    depen    = (color.GetType().GetProperty("dependency").GetValue(color, null));

            string[] deps         = (depen as IEnumerable).Cast <object>().Select(x => x.ToString()).ToArray();
            var      path         = basePath + "ej2-resource/styles/";
            var      templatepath = basePath + "template/dark/";
            string   templatefile = System.IO.File.ReadAllText(templatepath + theme + ".txt");

            templatefile = templatefile.Replace("{{:common}}", changes as string);
            string filecontent = "";

            filecontent = filecontent + templatefile;
            for (int i = 0; i < deps.Length; i++)
            {
                if (deps[i] == "base")
                {
                    path        = basePath + "ej2-resource/styles/";
                    path        = path + deps[i] + "/" + theme + ".scss";
                    filecontent = filecontent + System.IO.File.ReadAllText(path);
                }
                else
                {
                    String   searchfilename    = theme + ".scss";
                    String   sourcedirectories = basePath + "ej2-resource/styles/" + deps[i] + "/";
                    String[] files             = Directory.GetFiles(sourcedirectories, searchfilename, SearchOption.AllDirectories);
                    foreach (String file in files)
                    {
                        filecontent = filecontent + System.IO.File.ReadAllText(file);
                    }
                }
            }
            var    outputdir    = basePath + "resource/styles/";
            string ScssFilePath = outputdir;

            System.IO.Directory.CreateDirectory(ScssFilePath);
            sourcepath = ScssFilePath + "/" + theme + ".scss";

            System.IO.File.WriteAllText(sourcepath, filecontent);

            string result = sasscompiler(sourcepath);

            //delete all existing files and directories.
            sourcepath = ScssFilePath + "/" + theme + ".css";
            System.IO.File.WriteAllText(sourcepath, result);
            if (Directory.Exists(outputdir))
            {
                Directory.Delete(outputdir, true);
            }

            return(result);
        }
コード例 #13
0
        public string dark(ThemeProperties themes)

        {
            string theme    = (themes.GetType().GetProperty("theme").GetValue(themes, null)) as string;
            string basePath = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
            var    path     = basePath + "ej2-resource/styles/";
            var    depen    = (themes.GetType().GetProperty("dependency").GetValue(themes, null));

            string[] deps         = (depen as IEnumerable).Cast <object>().Select(x => x.ToString()).ToArray();
            string   filecontents = "";

            /* read a sass file */
            for (int i = 0; i < deps.Length; i++)
            {
                if (deps[i] == "base")
                {
                    path         = path + deps[i] + "/definition/" + theme + ".scss";
                    filecontents = filecontents + System.IO.File.ReadAllText(path);
                    path         = basePath + "ej2-resource/styles/";
                    path         = path + deps[i] + "/" + theme + ".scss";
                    filecontents = filecontents + System.IO.File.ReadAllText(path);
                }
                else
                {
                    //String searchfilename ="definition.scss";
                    //String searchfilename1 = theme + "-definition.scss";
                    //String searchfilename2 = theme + ".scss";
                    //String sourcedirectories = basePath + "ej2-resources1/styles/" + deps[i] + "/definitions";
                    //String[] files = Directory.GetFiles(sourcedirectories, searchfilename, SearchOption.AllDirectories);
                    //foreach (String file in files)
                    //{
                    //    filecontents = filecontents + System.IO.File.ReadAllText(file);
                    //}
                    //String[] files1 = Directory.GetFiles(sourcedirectories, searchfilename1, SearchOption.AllDirectories);
                    //foreach (String file in files1)
                    //{
                    //    filecontents = filecontents + System.IO.File.ReadAllText(file);
                    //}
                    //String[] files2 = Directory.GetFiles(sourcedirectories, searchfilename2, SearchOption.AllDirectories);
                    //foreach (String file in files2)
                    //{
                    //    filecontents = filecontents + System.IO.File.ReadAllText(file);
                    //}
                    String   searchfilename    = theme + ".scss";
                    String   sourcedirectories = basePath + "ej2-resource/styles/" + deps[i] + "/";
                    String[] files             = Directory.GetFiles(sourcedirectories, searchfilename, SearchOption.AllDirectories);
                    foreach (String file in files)
                    {
                        filecontents = filecontents + System.IO.File.ReadAllText(file);
                    }
                }
            }
            var outputdir = basePath + "resource/styles/";

            System.IO.Directory.CreateDirectory(outputdir);
            var sourcepath = outputdir + theme + ".scss";

            System.IO.File.WriteAllText(sourcepath, filecontents);

            var options = new SassOptions
            {
                InputPath = sourcepath
            };
            var sass   = new SassCompiler(options);
            var result = sass.Compile();

            return(result.Output);
        }
コード例 #14
0
        /// <summary>
        /// Initializes an instance of the <c>RichTextBoxExtended</c> class.
        /// </summary>
        public RichTextBoxExtended()
        {
            // Set appearance
            this.Background          = Brushes.White;
            this.BorderBrush         = Brushes.Black;
            this.BorderThickness     = new Thickness(1);
            this.Foreground          = Brushes.Black;
            this.Document.Background = Brushes.Transparent;
            this.Document.Foreground = this.Foreground;

            ThemeProperties.SetUseBackgroundStates(this, false);
            ThemeProperties.SetUseBorderStates(this, false);

            // Assign a custom context menu
            if (!BrowserInteropHelper.IsBrowserHosted)
            {
                RibbonControls.ContextMenu contextMenu = new RibbonControls.ContextMenu();
                RibbonControls.Menu        menu        = new RibbonControls.Menu();
                contextMenu.Items.Add(menu);
                menu.Items.Add(new RibbonControls.Button(System.Windows.Input.ApplicationCommands.Undo)
                {
                    KeyTipAccessText = "U"
                });
                menu.Items.Add(new RibbonControls.Button(System.Windows.Input.ApplicationCommands.Redo)
                {
                    KeyTipAccessText = "R"
                });
                menu.Items.Add(new RibbonControls.Separator());
                menu.Items.Add(new RibbonControls.Button(System.Windows.Input.ApplicationCommands.Cut)
                {
                    KeyTipAccessText = "T"
                });
                menu.Items.Add(new RibbonControls.Button(System.Windows.Input.ApplicationCommands.Copy)
                {
                    KeyTipAccessText = "C"
                });
                menu.Items.Add(new RibbonControls.Button(System.Windows.Input.ApplicationCommands.Paste)
                {
                    KeyTipAccessText = "P"
                });
                this.ContextMenu = contextMenu;

                // Attach a mini-toolbar to the context menu
                contextMenu.MiniToolBar = new ActiproSoftware.ProductSamples.RibbonSamples.Common.RichTextBoxMiniToolBar();

                // Attach to the context menu opening event
                this.ContextMenuOpening += OnContextMenuOpening;
            }

            // Add command bindings
            this.CommandBindings.Add(new CommandBinding(EditingCommands.AlignCenter, null, OnAlignCenterCanExecute));
            this.CommandBindings.Add(new CommandBinding(EditingCommands.AlignJustify, null, OnAlignJustifyCanExecute));
            this.CommandBindings.Add(new CommandBinding(EditingCommands.AlignLeft, null, OnAlignLeftCanExecute));
            this.CommandBindings.Add(new CommandBinding(EditingCommands.AlignRight, null, OnAlignRightCanExecute));
            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.ApplyBackground, OnApplyBackgroundExecute, OnApplyBackgroundCanExecute));
            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.ApplyDefaultBackground, OnApplyDefaultBackgroundExecute));
            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.ApplyDefaultForeground, OnApplyDefaultForegroundExecute));
            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.ApplyForeground, OnApplyForegroundExecute, OnApplyForegroundCanExecute));
            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.ClearFormatting, OnClearFormattingExecute));
            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.FontFamily, OnFontFamilyExecute, OnFontFamilyCanExecute));
            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.FontSize, OnFontSizeExecute, OnFontSizeCanExecute));
            this.CommandBindings.Add(new CommandBinding(EditingCommands.ToggleBold, null, OnToggleBoldCanExecute));
            this.CommandBindings.Add(new CommandBinding(EditingCommands.ToggleItalic, null, OnToggleItalicCanExecute));
            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.ToggleStrikethrough, OnToggleStrikethroughExecute, OnToggleStrikethroughCanExecute));
            this.CommandBindings.Add(new CommandBinding(EditingCommands.ToggleSubscript, null, OnToggleSubscriptCanExecute));
            this.CommandBindings.Add(new CommandBinding(EditingCommands.ToggleSuperscript, null, OnToggleSuperscriptCanExecute));
            this.CommandBindings.Add(new CommandBinding(EditingCommands.ToggleUnderline, null, OnToggleUnderlineCanExecute));
        }