public StoryButton(DragonObject drgObj, bool isWriter, StoryTreeManager stm, DragonTextEditor tb1, DragonTextEditor tb2) { this.drgObj = drgObj; this.isWriter = isWriter; this.stm = stm; this.tb1 = tb1; this.tb2 = tb2; Content = isWriter ? drgObj.writer : drgObj.storyName; HorizontalAlignment = HorizontalAlignment.Right; HorizontalContentAlignment = HorizontalAlignment.Left; Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00DDDDDD")); BorderBrush = new SolidColorBrush(Color.FromRgb(255, 255, 255)); Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255)); FontWeight = FontWeights.Bold; FontSize = 20; Height = isWriter ? 36 : 0; Visibility = isWriter ? Visibility.Visible : Visibility.Hidden; Width = isWriter ? 320 : 300; Margin = new Thickness(0, 0, 0, 0); Click += StoryButton_Click; }
private void SortByLanguage(string path, string[] bucket, string[] langTags) { // string[] imgExt = { ".jpg", ".png", ".jpeg", ".tiff" }; foreach (string langTag in langTags) { // bucket: // 0. writer // 1. file_name if (bucket[1].Contains(langTag)) { string storyName = bucket[1].Split(langTag)[0]; bool alreadyCategory = false; for (int i = 0; i < list.Count; i++) { if (list[i].storyName.Contains(storyName)) { list[i].AddLinkByLanguageTag(langTag, path); alreadyCategory = true; break; } } if (!alreadyCategory) { DragonObject dragonObj = new DragonObject(); dragonObj.writer = bucket[0]; dragonObj.storyName = storyName; dragonObj.AddLinkByLanguageTag(langTag, path); list.Add(dragonObj); } } // else // { // bool isImage = false; // foreach (var ext in imgExt) // { // string[] fileNameSplit = bucket[1].Split('.'); // if (fileNameSplit[fileNameSplit.Length - 1] == ext) // { // isImage = true; // break; // } // } // // if (isImage) // { // string storyName = bucket[1].Split(".")[0]; // bool alreadyCategory = false; // for (int i = 0; i < list.Count; i++) // { // if (list[i].storyName.Contains(storyName)) // { // list[i].AddLinkByLanguageTag(string.Empty, path); // alreadyCategory = true; // break; // } // } // // if (!alreadyCategory) // { // DragonObject dragonObj = new DragonObject(); // dragonObj.writer = bucket[0]; // dragonObj.storyName = storyName; // dragonObj.AddLinkByLanguageTag(string.Empty, path); // list.Add(dragonObj); // } // } // } } }
public void AddInfo(DragonObject additionalInfo) => drgObj = additionalInfo;