public void Remove(GridWidget Widget) { Widget.ParentDock = null; WidgetList.Remove(Widget); CanvasRoot.Children.Remove(Widget); Config.SaveWidgets(); }
public void Add(GridWidget Widget) { Widget.ParentDock = this; WidgetList.Add(Widget); CanvasRoot.Children.Add(Widget); Config.SaveWidgets(); }
private void LoadWidgets() { // 위젯 검색 string[] Widgets = Directory.GetFiles(ConfigManager.WidgetPath, "*.ini", SearchOption.AllDirectories); // 검색된 위젯 추가 foreach (string Path in Widgets) { // 위젯 구성 분석 INI Widget = new INI(Path); string Title = Widget.GetValue("General", "Title"); // 위젯 섬네일 컨트롤 생성 StackPanel WidgetStack = new StackPanel { Width = 120, Height = 120, Margin = new Thickness(15, 10, 0, 0) }; Image WidgerThumb = new Image { Width = 80, Height = 80, Source = ImageLoad(Directory.GetParent(Path) + "\\" + System.IO.Path.GetFileNameWithoutExtension(Path) + ".png") }; WidgetStack.Children.Add(WidgerThumb); TextBlock WidgetTitle = new TextBlock { Text = Title, Margin = new Thickness(0, 10, 0, 0), VerticalAlignment = VerticalAlignment.Bottom, HorizontalAlignment = HorizontalAlignment.Center }; WidgetStack.Children.Add(WidgetTitle); // 위젯 섬네일 컨트롤 이벤트 설정 WidgetStack.MouseLeftButtonDown += (s, e) => { IsDrawerOpen = false; GridWidget Target = new GridWidget { NowLoading = true }; if (Target.Load(Path)) { Add(Target); Target.StartMouseDown(); } }; // 콘텐츠 스택에 섬네일 컨트롤 추가 StackDrawerContent.Children.Add(WidgetStack); } }
public void BringToFront(GridWidget Widget) { int Max = 0; foreach (GridWidget Target in CanvasRoot.Children) { if (Target != Widget) { Max = Math.Max(Math.Max(Panel.GetZIndex(Target), Panel.GetZIndex(Widget)), Max); Console.WriteLine(Panel.GetZIndex(Target)); } } Panel.SetZIndex(Widget, Max + 1); }
private void LoadWidgets() { // 위젯 검색 string[] Widgets = Directory.GetFiles(ConfigManager.WidgetPath, "*.ini", SearchOption.AllDirectories); // 검색된 위젯 추가 foreach(string Path in Widgets) { // 위젯 구성 분석 INI Widget = new INI(Path); string Title = Widget.GetValue("General", "Title"); // 위젯 섬네일 컨트롤 생성 StackPanel WidgetStack = new StackPanel { Width = 120, Height = 120, Margin = new Thickness(15, 10, 0, 0) }; Image WidgerThumb = new Image { Width = 80, Height = 80, Source = ImageLoad(Directory.GetParent(Path) + "\\" + System.IO.Path.GetFileNameWithoutExtension(Path) + ".png") }; WidgetStack.Children.Add(WidgerThumb); TextBlock WidgetTitle = new TextBlock { Text = Title, Margin = new Thickness(0, 10, 0, 0), VerticalAlignment = VerticalAlignment.Bottom, HorizontalAlignment = HorizontalAlignment.Center }; WidgetStack.Children.Add(WidgetTitle); // 위젯 섬네일 컨트롤 이벤트 설정 WidgetStack.MouseLeftButtonDown += (s, e) => { IsDrawerOpen = false; GridWidget Target = new GridWidget { NowLoading = true }; if (Target.Load(Path)) { Add(Target); Target.StartMouseDown(); } }; // 콘텐츠 스택에 섬네일 컨트롤 추가 StackDrawerContent.Children.Add(WidgetStack); } }