From a6b7f8713951e4531dbcb25b1b6b13c6295570bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=92=D0=B5=D1=81?= =?UTF-8?q?=D0=B5=D0=BB=D0=BE=D0=B2?= Date: Sat, 20 Jul 2019 16:58:46 +0300 Subject: [PATCH] =?UTF-8?q?#7:=20=D0=BF=D1=80=D0=BE=D0=B4=D0=BE=D0=BB?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=BD=D0=B8=D0=B5=20=D0=B2=D1=8B=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D0=B0=20=D0=BC=D1=83=D1=81=D0=BE=D1=80=D0=B0=20=D0=B8?= =?UTF-8?q?=D0=B7=20=D0=BC=D0=B5=D0=B9=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SkinEditor/MainWindow.xaml | 58 +++++++++++++-------------- SkinEditor/MainWindow.xaml.cs | 74 +++++++++-------------------------- 2 files changed, 47 insertions(+), 85 deletions(-) diff --git a/SkinEditor/MainWindow.xaml b/SkinEditor/MainWindow.xaml index 0431498..6dfda9d 100644 --- a/SkinEditor/MainWindow.xaml +++ b/SkinEditor/MainWindow.xaml @@ -18,15 +18,15 @@ - - + + - - + + - - - + + + @@ -89,39 +89,39 @@ - + - - + + - - - - - + + + + + - - - + + + - + - + - - - - - - + + + + + + - - + + @@ -129,7 +129,7 @@ - + diff --git a/SkinEditor/MainWindow.xaml.cs b/SkinEditor/MainWindow.xaml.cs index 276b904..36868d5 100644 --- a/SkinEditor/MainWindow.xaml.cs +++ b/SkinEditor/MainWindow.xaml.cs @@ -25,7 +25,6 @@ public partial class MainWindow : Window //public static System.Windows.Threading.DispatcherTimer Animtimer = new System.Windows.Threading.DispatcherTimer(); анимация кнопки skinscan до первого нажатия public static List OnScreenImages = new List(); //лист со всеми (не со всеми) объектами Image, предназначенными для экспорта public static List OnScreenImagesNames = new List(); //это нужно уничтожить в дальнейшем (используется для поиска элементов в основном листе) - public static List CopyOnScreenImages = new List(); //лист с дубликатами некоторых объектов Image (_Copy); выкупить, как спаунить один и тот же объект в нескольких местах (относительные ссылки на него) public static List GridScoreImages = new List(); //лист с Image из GridScore, нужен для "удобной" работы с ним (не перебирая ~50 элементов в _Copy)(_Score) public static List SkinIniPropertiesObj = new List(); public MainWindow() @@ -106,31 +105,9 @@ private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) }; if (myDialog.ShowDialog() == true) { - if (ClickedImage.Name.Contains("_Copy")) //нажатие на fake - { - int IndexOfCopy = ClickedImage.Name.IndexOf("_Copy"); - string OnScreenOriginName = ClickedImage.Name.Remove(IndexOfCopy); - int OnScreenIndex = OnScreenImagesNames.IndexOf(OnScreenOriginName); - - OnScreenImages[OnScreenIndex].Source = SkinWorker.GetImageByDirectPath(myDialog.FileName); - CopyOnScreenImages[CopyOnScreenImages.IndexOf(ClickedImage)].Source = SkinWorker.GetImageByDirectPath(myDialog.FileName); - - foreach (Image elem in CopyOnScreenImages) - { - if (elem.Name.Contains(OnScreenOriginName) && elem.Name != ClickedImage.Name) - elem.Source = OnScreenImages[OnScreenIndex].Source; - } - } - else //нажатие на оригинальный элемент - { - int OnScreenIndex = OnScreenImagesNames.IndexOf(ClickedImage.Name); - OnScreenImages[OnScreenIndex].Source = SkinWorker.GetImageByDirectPath(myDialog.FileName); - foreach (Image elem in CopyOnScreenImages) - { - if (elem.Name.Contains(ClickedImage.Name)) - elem.Source = OnScreenImages[OnScreenIndex].Source; - } - } + + ClickedImage.Source = SkinWorker.GetImageByDirectPath(myDialog.FileName); + SetCursor();//костыль } } @@ -204,10 +181,6 @@ private void ComboBoxExistingSkin_SelectionChanged(object sender, SelectionChang elem.Source = SkinWorker.GetImageBySenderName(path, elem); } - foreach (Image elem in CopyOnScreenImages) - { - elem.Source = SkinWorker.GetImageBySenderName(path, elem); - } ButtonSkinIni_Click(sender, e); SetCursor(); } @@ -223,10 +196,6 @@ private void Image_Initialized(object sender, EventArgs e) ProgressBarFilesMax++; //factory new return; } - else - { - CopyOnScreenImages.Add(InitImage); - } if (InitImage.Name.Contains("_Score")) { @@ -234,6 +203,11 @@ private void Image_Initialized(object sender, EventArgs e) } } + private void TextBoxSkinIni_Initialized(object sender, EventArgs e) + { + SkinIniPropertiesObj.Add(sender); + } + private void Image_Loaded(object sender, RoutedEventArgs e) // добавление кода сюда приведет к увеличению времени затупа в переходах между экранами { @@ -361,22 +335,23 @@ private void TextBoxRankingScore_TextChanged(object sender, TextChangedEventArgs if (ComboBoxExistingSkin.SelectedValue != null) { - int i = 0; + int ElementIndex = 0; foreach (char elem in tempchar) { if (elem == ' ') { - GridScoreImages[i].Visibility = Visibility.Hidden; + GridScoreImages[ElementIndex].Visibility = Visibility.Hidden; } else { - Image temp = new Image { Name = $"score_{elem}" }; - GridScoreImages[i].Source = SkinWorker.GetImageBySenderName(ComboBoxExistingSkin.SelectedValue.ToString(), temp); - GridScoreImages[i].Visibility = Visibility.Visible; - GridScoreImages[i].Name = GridScoreImages[i].Name.Replace - ($"score_{GridScoreImages[i].Name[6]}", - $"score_{GridScoreImages[i].Source.ToString()[GridScoreImages[i].Source.ToString().Length - 5]}"); // L O L - i++; + Binding tempbind = new Binding(); + tempbind.ElementName = $"score_{elem}"; + tempbind.Path = new PropertyPath("Source"); + tempbind.Mode = BindingMode.TwoWay; + + GridScoreImages[ElementIndex].SetBinding(Image.SourceProperty, tempbind); + GridScoreImages[ElementIndex].Visibility = Visibility.Visible; + ElementIndex++; } } } @@ -414,11 +389,6 @@ private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs