예제 #1
0
        private List <AppSkin> GetAppSkins()
        {
            List <AppSkin> appSkins = new List <AppSkin>();

            string[] filenames = Directory.GetFiles(string.Format("{0}..\\skins\\", AppDomain.CurrentDomain.BaseDirectory), "*.xaml");
            foreach (string filename in filenames)
            {
                string name = System.IO.Path.GetFileNameWithoutExtension(filename);
                try
                {
                    ResourceDictionary rd = new ResourceDictionary();
                    rd.Source = new Uri(filename, UriKind.Absolute);
                    AppSkin appSkin = new AppSkin()
                    {
                        Name = name, ResrcDict = rd
                    };
                    appSkins.Add(appSkin);
                }
                catch (Exception)
                {
                }
            }

            return(appSkins);
        }
예제 #2
0
        private AppSkin CreateMainStyle(string name)
        {
            string styleFileName = string.Format("{0}..\\skins\\{1}.xaml", AppDomain.CurrentDomain.BaseDirectory, name);

            if (File.Exists(styleFileName))
            {
                try
                {
                    ResourceDictionary rd = new ResourceDictionary();
                    rd.Source = new Uri(styleFileName, UriKind.Absolute);//"H:\\GitHub\\CodeLab\\GDDST.GIS\\output\\skins\\Black.xaml"
                    AppSkin ms = new AppSkin()
                    {
                        Name = name, ResrcDict = rd
                    };
                    return(ms);
                }
                catch (Exception)
                {
                    return(null);
                }
            }
            return(null);
        }