Exemple #1
0
        public static void LoadSkin(SkinEnum skinEnum)
        {
            ActualSkin = skinEnum;
            //Common
            setResource(SkinKey.MainForeground, Brushes.Green);
            //Specific
            switch (skinEnum)
            {
            case SkinEnum.Light:
                setResource(SkinKey.MainBackground, new SolidColorBrush(ColorFromHex("#FFFFFF00")));
                break;

            case SkinEnum.Dark:
                setResource(SkinKey.MainBackground, new SolidColorBrush(ColorFromHex("#FF0F0F0F")));
                break;

            case SkinEnum.Red:
                setResource(SkinKey.MainBackground, new SolidColorBrush(ColorFromHex("#FFFF0000")));
                break;

            default:
                break;
            }
            if (skinEnum == SkinEnum.Light)
            {
            }
            if (skinEnum == SkinEnum.Dark)
            {
            }
        }
        private void btnSwap_Click(object sender, RoutedEventArgs e)
        {
            SkinEnum[]                skinEnums  = (SkinEnum[])Enum.GetValues(typeof(SkinEnum));
            LinkedList <SkinEnum>     linkedList = new LinkedList <SkinEnum>(skinEnums);
            LinkedListNode <SkinEnum> listNode   = linkedList.Find(Skin.ActualSkin);
            SkinEnum next = listNode.Next != null?listNode.Next.Value: linkedList.First.Value;

            Skin.LoadSkin(next);
        }
Exemple #3
0
 public void Change(SkinEnum Skin, ResourceDictionary resources)
 {
     skin = Skin;
     resources.Clear();
     resources.MergedDictionaries.Clear();
     if (skin == SkinEnum.Default)
     {
         ApplyResources("/Styles;component/Default.xaml", resources);
     }
     else if (skin == SkinEnum.Nightmod)
     {
         ApplyResources("/Styles;component/NightMod.xaml", resources);
     }
     ApplyResources("/Styles;component/Shared.xaml", resources);
 }
 public void SendChangeSkin(SkinEnum skin)
 {
     _skin.Change(skin, Resources);
     if (mainWindow == null)
     {
         mainWindow = new MainWindow();
     }
     else
     {
         MainWindow window = new MainWindow();
         mainWindow.Close();
         mainWindow = window;
     }
     mainWindow.Show();
 }