private void com_changeLang_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var cb              = sender as ComboBox;
            var langueModel     = cb.SelectedItem as LangueViewModel;
            var langueViewModel = new LangueViewModel();

            langueViewModel.ChangeLangue(langueModel);
        }
Exemplo n.º 2
0
        public void ChangeLangue(LangueViewModel skinModel)
        {
            if (skinModel == null)
            {
                return;
            }
            var newSkinRes = Application.LoadComponent(new Uri(skinModel.ResFilePath, UriKind.RelativeOrAbsolute)) as ResourceDictionary;

            if (newSkinRes == null)
            {
                return;
            }
            newSkinRes.Source = new Uri(skinModel.ResFilePath, UriKind.RelativeOrAbsolute);
            var oldSkinRes = Application.Current.Resources.MergedDictionaries.Where(x => LangueResList.Any(y => Path.GetFileName(y.ResFilePath) == Path.GetFileName(x.Source.OriginalString))).SingleOrDefault();

            if (oldSkinRes == null)
            {
                return;
            }
            Application.Current.Resources.MergedDictionaries.Remove(oldSkinRes);
            Application.Current.Resources.MergedDictionaries.Add(newSkinRes);
        }