|
@@ -1015,9 +1015,19 @@ namespace PRSDesktop
|
|
|
private void SetupDock<TSecurityDescriptor>(LayoutAnchorable layout, IDockPanel dock)
|
|
|
where TSecurityDescriptor : ISecurityDescriptor, new()
|
|
|
{
|
|
|
- layout.IsVisible = Security.IsAllowed<TSecurityDescriptor>();
|
|
|
- if (layout.IsVisible && (ClientFactory.UserGuid != Guid.Empty))
|
|
|
- dock.Setup();
|
|
|
+ if (Security.IsAllowed<TSecurityDescriptor>())
|
|
|
+ {
|
|
|
+ if(!DockGroup.Children.Any(x => x == layout))
|
|
|
+ {
|
|
|
+ DockGroup.Children.Add(layout);
|
|
|
+ }
|
|
|
+ if (layout.IsVisible && (ClientFactory.UserGuid != Guid.Empty))
|
|
|
+ dock.Setup();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DockGroup.RemoveChild(layout);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void LoadApplicationState()
|
|
@@ -1432,6 +1442,7 @@ namespace PRSDesktop
|
|
|
{
|
|
|
ExecuteLogout();
|
|
|
}
|
|
|
+ ClearTrackingKanban();
|
|
|
|
|
|
ClientFactory.InvalidateUser();
|
|
|
ConfigureMainScreen();
|
|
@@ -1547,6 +1558,88 @@ namespace PRSDesktop
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
}
|
|
|
+ private void UnloadWindow()
|
|
|
+ {
|
|
|
+ if (CurrentPanel != null)
|
|
|
+ {
|
|
|
+ Heartbeat(DateTime.Now - CurrentPanel_Ticks, true);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ CurrentPanel.Shutdown();
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ Logger.Send(LogType.Error, ClientFactory.UserID, string.Format("Error in UnloadWindow(): {0}\n{1}", e.Message, e.StackTrace));
|
|
|
+ }
|
|
|
+
|
|
|
+ CurrentPanel_Ticks = DateTime.MinValue;
|
|
|
+ CurrentPanel_Label = "";
|
|
|
+ CurrentPanel_Clicks = 0;
|
|
|
+ CurrentPanel_Keys = 0;
|
|
|
+
|
|
|
+ Title =
|
|
|
+ $"{CurrentPanel_Label} - {(String.Equals(App.Profile?.ToUpper(), "DEFAULT") ? "PRS Desktop" : App.Profile)} (Release {CoreUtils.GetVersion()})";
|
|
|
+
|
|
|
+ if (CurrentTab != null)
|
|
|
+ {
|
|
|
+ var border = VisualUtils.EnumChildrenOfType(CurrentTab, typeof(Border)).LastOrDefault();
|
|
|
+ if (border != null)
|
|
|
+ {
|
|
|
+ ((Border)border).Background = new SolidColorBrush(Colors.Transparent);
|
|
|
+ ((Border)border).BorderBrush = new SolidColorBrush(Colors.Transparent);
|
|
|
+ }
|
|
|
+
|
|
|
+ var ReportsBar = FindRibbonBar(CurrentTab, x => x.Header.Equals("Print"));
|
|
|
+ if (ReportsBar is not null)
|
|
|
+ {
|
|
|
+ ReportsBar.Items.Clear();
|
|
|
+ ReportsBar.Visibility = Visibility.Collapsed;
|
|
|
+ ReportsBar.IsLauncherVisible = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ var ActionBar = FindRibbonBar(CurrentTab, x => x.Header.Equals("Actions"));
|
|
|
+ if (ActionBar is not null)
|
|
|
+ {
|
|
|
+ ActionBar.IsLauncherVisible = false;
|
|
|
+ foreach (var module in CurrentModules)
|
|
|
+ ActionBar.Items.Remove(module);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CurrentTab = null;
|
|
|
+ CurrentButton = null;
|
|
|
+ CurrentPanel = null;
|
|
|
+ ContentControl.Content = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void SecondaryWindow_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ if (CurrentPanel == null)
|
|
|
+ return;
|
|
|
+ var id = Guid.NewGuid();
|
|
|
+ var window = new Tuple<string, string, double, double, double, double>(
|
|
|
+ CurrentPanel.GetType().EntityName(),
|
|
|
+ CurrentPanel_Label,
|
|
|
+ Left + 100,
|
|
|
+ Top + 100,
|
|
|
+ Width - 200,
|
|
|
+ Height - 200
|
|
|
+ );
|
|
|
+ App.DatabaseSettings.SecondaryWindows[id] = window;
|
|
|
+ new LocalConfiguration<DatabaseSettings>(App.Profile).Save(App.DatabaseSettings);
|
|
|
+ _secondarywindows[id] = new SecondaryWindow(
|
|
|
+ id,
|
|
|
+ window.Item1,
|
|
|
+ window.Item2,
|
|
|
+ window.Item3,
|
|
|
+ window.Item4,
|
|
|
+ window.Item5,
|
|
|
+ window.Item6
|
|
|
+ );
|
|
|
+ _secondarywindows[id].Show();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private void RibbonWindow_Activated(object sender, EventArgs e)
|
|
|
{
|
|
@@ -1701,88 +1794,6 @@ namespace PRSDesktop
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- private void UnloadWindow()
|
|
|
- {
|
|
|
- if (CurrentPanel != null)
|
|
|
- {
|
|
|
- Heartbeat(DateTime.Now - CurrentPanel_Ticks, true);
|
|
|
- try
|
|
|
- {
|
|
|
- CurrentPanel.Shutdown();
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- Logger.Send(LogType.Error, ClientFactory.UserID, string.Format("Error in UnloadWindow(): {0}\n{1}", e.Message, e.StackTrace));
|
|
|
- }
|
|
|
-
|
|
|
- CurrentPanel_Ticks = DateTime.MinValue;
|
|
|
- CurrentPanel_Label = "";
|
|
|
- CurrentPanel_Clicks = 0;
|
|
|
- CurrentPanel_Keys = 0;
|
|
|
-
|
|
|
- Title =
|
|
|
- $"{CurrentPanel_Label} - {(String.Equals(App.Profile?.ToUpper(), "DEFAULT") ? "PRS Desktop" : App.Profile)} (Release {CoreUtils.GetVersion()})";
|
|
|
-
|
|
|
- if (CurrentTab != null)
|
|
|
- {
|
|
|
- var border = VisualUtils.EnumChildrenOfType(CurrentTab, typeof(Border)).LastOrDefault();
|
|
|
- if (border != null)
|
|
|
- {
|
|
|
- ((Border)border).Background = new SolidColorBrush(Colors.Transparent);
|
|
|
- ((Border)border).BorderBrush = new SolidColorBrush(Colors.Transparent);
|
|
|
- }
|
|
|
-
|
|
|
- var ReportsBar = FindRibbonBar(CurrentTab, x => x.Header.Equals("Print"));
|
|
|
- if(ReportsBar is not null)
|
|
|
- {
|
|
|
- ReportsBar.Items.Clear();
|
|
|
- ReportsBar.Visibility = Visibility.Collapsed;
|
|
|
- ReportsBar.IsLauncherVisible = false;
|
|
|
- }
|
|
|
-
|
|
|
- var ActionBar = FindRibbonBar(CurrentTab, x => x.Header.Equals("Actions"));
|
|
|
- if(ActionBar is not null)
|
|
|
- {
|
|
|
- ActionBar.IsLauncherVisible = false;
|
|
|
- foreach (var module in CurrentModules)
|
|
|
- ActionBar.Items.Remove(module);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- CurrentTab = null;
|
|
|
- CurrentButton = null;
|
|
|
- CurrentPanel = null;
|
|
|
- ContentControl.Content = null;
|
|
|
- }
|
|
|
-
|
|
|
- private void SecondaryWindow_Click(object sender, RoutedEventArgs e)
|
|
|
- {
|
|
|
- if (CurrentPanel == null)
|
|
|
- return;
|
|
|
- var id = Guid.NewGuid();
|
|
|
- var window = new Tuple<string, string, double, double, double, double>(
|
|
|
- CurrentPanel.GetType().EntityName(),
|
|
|
- CurrentPanel_Label,
|
|
|
- Left + 100,
|
|
|
- Top + 100,
|
|
|
- Width - 200,
|
|
|
- Height - 200
|
|
|
- );
|
|
|
- App.DatabaseSettings.SecondaryWindows[id] = window;
|
|
|
- new LocalConfiguration<DatabaseSettings>(App.Profile).Save(App.DatabaseSettings);
|
|
|
- _secondarywindows[id] = new SecondaryWindow(
|
|
|
- id,
|
|
|
- window.Item1,
|
|
|
- window.Item2,
|
|
|
- window.Item3,
|
|
|
- window.Item4,
|
|
|
- window.Item5,
|
|
|
- window.Item6
|
|
|
- );
|
|
|
- _secondarywindows[id].Show();
|
|
|
- }
|
|
|
-
|
|
|
//private Style tabselected = null;
|
|
|
//private Style tabunselected = null;
|
|
|
|
|
@@ -3548,7 +3559,9 @@ namespace PRSDesktop
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
-
|
|
|
+
|
|
|
+ #region Tracking Kanban
|
|
|
+
|
|
|
private void SelectTask_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
ContextMenu menu = new ContextMenu();
|
|
@@ -3586,6 +3599,50 @@ namespace PRSDesktop
|
|
|
|
|
|
private Assignment? _kanbantrackingassignment = null;
|
|
|
|
|
|
+ private void SetTrackingKanban(Guid kanbanID, string header)
|
|
|
+ {
|
|
|
+ SelectedTaskName.Content = header;
|
|
|
+
|
|
|
+ var createNewAssignment = false;
|
|
|
+
|
|
|
+ if (_kanbantrackingassignment is not null)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (_kanbantrackingassignment.Finish < DateTime.Now.TimeOfDay)
|
|
|
+ {
|
|
|
+ _kanbantrackingassignment.Finish = DateTime.Now.TimeOfDay;
|
|
|
+ new Client<Assignment>().Save(_kanbantrackingassignment, "");
|
|
|
+ }
|
|
|
+
|
|
|
+ // Update Existing Kanban
|
|
|
+ if (kanbanID == Guid.Empty)
|
|
|
+ _kanbantrackingassignment = null;
|
|
|
+ else if (_kanbantrackingassignment.Task.ID != kanbanID)
|
|
|
+ {
|
|
|
+ createNewAssignment = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (kanbanID != Guid.Empty)
|
|
|
+ {
|
|
|
+ createNewAssignment = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(createNewAssignment)
|
|
|
+ {
|
|
|
+ _kanbantrackingassignment = new Assignment();
|
|
|
+ _kanbantrackingassignment.Task.ID = kanbanID;
|
|
|
+ _kanbantrackingassignment.EmployeeLink.ID = App.EmployeeID;
|
|
|
+ _kanbantrackingassignment.Title = header;
|
|
|
+ _kanbantrackingassignment.Date = DateTime.Today;
|
|
|
+ _kanbantrackingassignment.Start = DateTime.Now.TimeOfDay;
|
|
|
+ _kanbantrackingassignment.Finish = DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 2, 0));
|
|
|
+ new Client<Assignment>().Save(_kanbantrackingassignment, "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ClearTrackingKanban()
|
|
|
+ => SetTrackingKanban(Guid.Empty, "(No Task Selected)");
|
|
|
+
|
|
|
private void CreateTaskMenu(ItemCollection items, String title, Guid id)
|
|
|
{
|
|
|
var item = new MenuItem()
|
|
@@ -3597,48 +3654,13 @@ namespace PRSDesktop
|
|
|
{
|
|
|
if (o is not MenuItem menu) return;
|
|
|
|
|
|
- Guid id = (Guid)item.Tag;
|
|
|
- SelectedTaskName.Content = menu.Header;
|
|
|
-
|
|
|
- if (_kanbantrackingassignment is not null)
|
|
|
- {
|
|
|
-
|
|
|
- if (_kanbantrackingassignment.Finish < DateTime.Now.TimeOfDay)
|
|
|
- {
|
|
|
- _kanbantrackingassignment.Finish = DateTime.Now.TimeOfDay;
|
|
|
- new Client<Assignment>().Save(_kanbantrackingassignment, "");
|
|
|
- }
|
|
|
-
|
|
|
- // Update Existing Kanban
|
|
|
- if (id == Guid.Empty)
|
|
|
- _kanbantrackingassignment = null;
|
|
|
- else if (_kanbantrackingassignment.Task.ID != id)
|
|
|
- {
|
|
|
- _kanbantrackingassignment = new Assignment();
|
|
|
- _kanbantrackingassignment.Task.ID = id;
|
|
|
- _kanbantrackingassignment.EmployeeLink.ID = App.EmployeeID;
|
|
|
- _kanbantrackingassignment.Title = menu.Header.ToString() ?? "";
|
|
|
- _kanbantrackingassignment.Date = DateTime.Today;
|
|
|
- _kanbantrackingassignment.Start = DateTime.Now.TimeOfDay;
|
|
|
- _kanbantrackingassignment.Finish = DateTime.Now.TimeOfDay.Add(new TimeSpan(0,2,0));
|
|
|
- new Client<Assignment>().Save(_kanbantrackingassignment, "");
|
|
|
- }
|
|
|
- }
|
|
|
- else if (id != Guid.Empty)
|
|
|
- {
|
|
|
- _kanbantrackingassignment = new Assignment();
|
|
|
- _kanbantrackingassignment.Task.ID = id;
|
|
|
- _kanbantrackingassignment.EmployeeLink.ID = App.EmployeeID;
|
|
|
- _kanbantrackingassignment.Title = menu.Header.ToString() ?? "";
|
|
|
- _kanbantrackingassignment.Date = DateTime.Today;
|
|
|
- _kanbantrackingassignment.Start = DateTime.Now.TimeOfDay;
|
|
|
- _kanbantrackingassignment.Finish = DateTime.Now.TimeOfDay.Add(new TimeSpan(0,2,0));
|
|
|
- new Client<Assignment>().Save(_kanbantrackingassignment, "");
|
|
|
- }
|
|
|
+ SetTrackingKanban((Guid)item.Tag, (menu.Header as string) ?? "");
|
|
|
};
|
|
|
items.Add(item);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
private void DockPanel_OnIsActiveChanged(object? sender, EventArgs e)
|
|
|
{
|
|
|
var layout = sender as LayoutAnchorable;
|
|
@@ -3650,7 +3672,7 @@ namespace PRSDesktop
|
|
|
var dock = content is IDockPanel panel ? panel : content?.FindVisualChildren<IDockPanel>().FirstOrDefault();
|
|
|
if (dock == null)
|
|
|
return;
|
|
|
- if (layout.IsActive)
|
|
|
+ if (layout.IsActive && layout.IsVisible)
|
|
|
dock.Refresh();
|
|
|
}
|
|
|
|