コード例 #1
0
        public MainWindow()
        {
            InitializeComponent();
#if DEBUG
            miDeveloper.IsEnabled = true;
            miDeveloper.SetValue(VisibilityProperty, Visibility.Visible);
#else
            miDeveloper.IsEnabled = false;
            miDeveloper.SetValue(VisibilityProperty, Visibility.Hidden);
#endif

            if (!Directory.Exists(SkinsPath))
            {
                try
                {
                    Directory.CreateDirectory(SkinsPath);
                }
                catch
                {
                    MessageBox.Show("Unable to create UI skins directory in application folder!", "Application Error", MessageBoxButton.OK, MessageBoxImage.Stop);
                    Close();
                }
            }

            if (!Directory.Exists(DDOPath))
            {
                try
                {
                    Directory.CreateDirectory(DDOPath);
                }
                catch
                {
                    MessageBox.Show("Unable to create the appropriate folder in your documents folder!", "Application Error", MessageBoxButton.OK, MessageBoxImage.Stop);
                    Close();
                }
            }

            miBackupSkins.IsEnabled = !string.IsNullOrWhiteSpace(SettingsManager.data.BackupPath);

            // scan local Skins directory for "installed" skins
            var skindefs = Directory.GetFiles(SkinsPath, "SkinDefinition.xml", SearchOption.AllDirectories);
            foreach (var sd in skindefs)
            {
                DDOUISkin skin = DDOUISkin.Load(sd);
                if (skin != null)
                {
                    Skins.Add(skin);
                }
            }
            lvSkins.ItemsSource = Skins;
        }