private void PART_AddCustomIcon_Click(object sender, RoutedEventArgs e) { var result = API.Instance.Dialogs.SelectIconFile(); if (!result.IsNullOrEmpty()) { string PathDest = Path.Combine(plugin.GetPluginUserDataPath(), Path.GetFileName(result)); FileSystem.CopyFile(result, PathDest); PART_IconCustom.Tag = PathDest; PART_IconCustom.Source = BitmapExtensions.BitmapFromFile(PathDest); } PART_TextChanged(null, null); }
private void PART_AddCustomIcon_Click(object sender, RoutedEventArgs e) { int index = int.Parse(((Button)sender).Tag.ToString()); var result = _PlayniteApi.Dialogs.SelectIconFile(); if (!result.IsNullOrEmpty()) { string PathDest = Path.Combine(_plugin.GetPluginUserDataPath(), Path.GetFileName(result)); FileSystem.CopyFile(result, PathDest); List <ItemFeature> itemFeatures = ((List <ItemFeature>)PART_ListItemFeatures.ItemsSource); itemFeatures[index].IconCustom = PathDest; PART_ListItemFeatures.ItemsSource = null; PART_ListItemFeatures.ItemsSource = itemFeatures; } }