public void OnGui() { var visibleWindow = IsVisible(); if (visibleWindow == VisibleWindow.None) { _lastVisibleWindow = VisibleWindow.None; if (_guiActive) { _folderTreeView?.StopMonitoringFiles(); } _guiActive = false; return; } _guiActive = true; if (_lastVisibleWindow != visibleWindow) { RefreshCurrentWindow(); } var screenRect = GetDisplayRect(); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(362, screenRect, TreeWindow, "Select character folder"); IMGUIUtils.EatInputInRect(screenRect); }
private static void RefreshCurrentWindow() { var visibleWindow = IsVisible(); _lastVisibleWindow = visibleWindow; var resetTree = false; if (visibleWindow == VisibleWindow.Load) { if (_charaLoad != null) { _charaLoad.charaLists.Clear(); // can we pass _charaLoad.charaLists directly rather than allocating new list and assigning? var list = new List <GameCharaFileInfo>(); GameCharaFileInfoAssist.AddList(list, _folderTreeView.CurrentFolder, 0, (byte)1, true, true, false, false, true, false); _charaLoad.charaLists = list; _charaLoad.ReDrawListView(); resetTree = true; } } if (resetTree) { _folderTreeView.ResetTreeCache(); } }
internal static void SaveFilePatch(ref string path) { try { if (_makerCanvas == null) { return; } var newFolder = _folderTreeView?.CurrentFolder; if (newFolder == null) { return; } var name = Path.GetFileName(path); path = Path.Combine(newFolder, name); // Force reload _lastRefreshed = VisibleWindow.None; } catch (Exception ex) { UnityEngine.Debug.LogError(ex); } }
private static void RefreshCurrentWindow() { var visibleWindow = IsVisible(); _lastRefreshed = visibleWindow; var resetTree = false; switch (visibleWindow) { case VisibleWindow.Load: if (_charaLoad != null) { _charaLoad.UpdateClothesList(); resetTree = true; } break; case VisibleWindow.Save: if (_charaSave != null) { _charaSave.UpdateClothesList(); resetTree = true; } break; } // clear tree cache if (resetTree) { _folderTreeView.ResetTreeCache(); } }
public void OnGui() { //todo When loading a coordinate it resets to the main folder without deselect in menu var visibleWindow = IsVisible(); if (visibleWindow == VisibleWindow.None) { _lastRefreshed = VisibleWindow.None; if (_guiActive) { _folderTreeView?.StopMonitoringFiles(); _guiActive = false; } return; } _guiActive = true; if (_lastRefreshed != visibleWindow) { RefreshCurrentWindow(); } var screenRect = MakerFolders.GetDisplayRect(); IMGUIUtils.DrawSolidBox(screenRect); GUILayout.Window(362, screenRect, TreeWindow, "Select clothes folder"); IMGUIUtils.EatInputInRect(screenRect); }
private void RemoveButton(VisibleWindow window) { if (_buttonMap.ContainsKey(window.Hwnd))// && !window.IsMinimized) { _flp.Controls.Remove(_buttonMap[window.Hwnd]); _buttonMap[window.Hwnd].Dispose(); _buttonMap.Remove(window.Hwnd); window.ShowButtonOnTaskbar(true); } }
private void AddButton(VisibleWindow window) { if (!_buttonMap.ContainsKey(window.Hwnd)) { var btn = new TaskbarButton(window) { Height = GetButtonHeight(), Width = GetButtonWidth(), }; _flp.Controls.Add(btn); _buttonMap.Add(window.Hwnd, btn); window.ShowButtonOnTaskbar(false); } }
public TaskbarButton(VisibleWindow window) { if (window == null) throw new ArgumentNullException("window", "window is null."); Window = window; Icon = window.Icon; Image = Icon.ToBitmap(); Text = window.Title; Margin = Padding.Empty; //TODO: find a way to do this managed... // it just doesnt work to call this and use // a managed VisualStyleRenderer instead =/ UxTheme.SetWindowTheme(base.Handle, "Taskband", null); }
private static void Timer_Elapsed(object sender, ElapsedEventArgs e) { var activeWindow = Win32.GetForegroundWindow(); var windows = new List <VisibleWindow>(); var nativeWindows = NativeWindow.EnumerateWindows(); foreach (NativeWindow wnd in nativeWindows) { var hWnd = wnd.hWnd; if (Win32.HasWindow(hWnd)) { var screen = Win32.GetScreenFromWindow(hWnd); VisibleWindow window = _openWindows.FirstOrDefault(w => w.Hwnd == hWnd) ?? new VisibleWindow(wnd); windows.Add(window); window.Screen = screen; window.IsForeground = window.Hwnd == activeWindow; if (!_openWindows.Contains(window)) { Mediator.Send(new WindowAddedMessage { Window = window }); } } } //TODO: remove this, mediator will notify about added stuff. // removal and screen change...find a better place for it. if (windows.Any()) { //TODO: sometimes a window gets lost in the loop above, // and is removed here...next loop, its back? var newWindows = windows.Where(w => !_openWindows.Contains(w)).ToArray(); var goneWindows = _openWindows.Where(w => !windows.Contains(w)).ToArray(); foreach (var newWindow in newWindows) { _openWindows.Add(newWindow); } foreach (var oldWindow in goneWindows) { _openWindows.Remove(oldWindow); Mediator.Send(new WindowRemovedMessage { Window = oldWindow }); } } }
public TaskbarButton(VisibleWindow window) { if (window == null) { throw new ArgumentNullException("window", "window is null."); } Window = window; Icon = window.Icon; Image = Icon.ToBitmap(); Text = window.Title; Margin = Padding.Empty; //TODO: find a way to do this managed... // it just doesnt work to call this and use // a managed VisualStyleRenderer instead =/ UxTheme.SetWindowTheme(base.Handle, "Taskband", null); }
private static string CardSavePathModifier(string currentDirectoryPath) { if (_makerCanvas == null) { return(currentDirectoryPath); } var newFolder = _folderTreeView?.CurrentFolder; if (newFolder != null) { // Force reload _lastRefreshed = VisibleWindow.None; return(newFolder); } return(currentDirectoryPath); }