| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 | 
							- using System;
 
- using System.ComponentModel;
 
- using System.Diagnostics;
 
- using System.Drawing;
 
- using System.Linq;
 
- using System.Windows;
 
- using System.Windows.Controls;
 
- using System.Windows.Media;
 
- using Comal.Classes;
 
- using InABox.Clients;
 
- using InABox.Configuration;
 
- using InABox.Core;
 
- using InABox.DynamicGrid;
 
- using InABox.Reports;
 
- using InABox.Core.Reports;
 
- using InABox.Scripting;
 
- using InABox.Wpf.Reports;
 
- using InABox.WPF;
 
- using PRSDesktop.Configuration;
 
- using Fluent;
 
- using Button = Fluent.Button;
 
- using ContextMenu = System.Windows.Controls.ContextMenu;
 
- using System.Collections.Generic;
 
- namespace PRSDesktop;
 
- /// <summary>
 
- ///     Interaction logic for SecondaryWindow.xaml
 
- /// </summary>
 
- public partial class SecondaryWindow : RibbonWindow, IPanelHostControl
 
- {
 
-     private readonly Guid _id = Guid.Empty;
 
-     private readonly string _modulesection = "";
 
-     private readonly string _type = "";
 
-     private bool bLoaded;
 
-     private List<Control> CurrentModules = new List<Control>();
 
-     public IBasePanel Panel { get; private set; }
 
-     private PanelHost PanelHost;
 
-     public SecondaryWindow(Guid id, string type, string modulesection, double left, double top, double width, double height)
 
-     {
 
-         PanelHost = new PanelHost(this);
 
-         _id = id;
 
-         _modulesection = modulesection;
 
-         InitializeComponent();
 
-         Left = left;
 
-         Top = top;
 
-         Width = width;
 
-         Height = height;
 
-         Title = string.Format("{0} - PRS Desktop (Release {1})", modulesection, CoreUtils.GetVersion());
 
-         SecondaryTab.Header = modulesection;
 
-         
 
-         Panel = PanelHost.LoadPanel(Type.GetType(type), modulesection);
 
-         ContentBorder.Child = Panel as UIElement;
 
-     }
 
-     private void Window_Loaded(object sender, RoutedEventArgs e)
 
-     {
 
-         PanelHost.Refresh();
 
-         bLoaded = true;
 
-     }
 
-     private void RefreshMenu_Click(object sender, RoutedEventArgs e)
 
-     {
 
-         PanelHost.Refresh();
 
-     }
 
-     private void Wiki_Click(object sender, RoutedEventArgs e)
 
-     {
 
-         Process.Start("https://prsdigital.com.au/wiki/index.php/" + _type.Replace(" ", "_").Replace("/", ""));
 
-     }
 
-     #region Save / Load Window Location
 
-     private void SaveSettings()
 
-     {
 
-         if (App.IsClosing)
 
-             return;
 
-         var tuple = new Tuple<string, string, double, double, double, double>(
 
-             Panel.GetType().EntityName(),
 
-             _modulesection,
 
-             Left,
 
-             Top,
 
-             Width,
 
-             Height
 
-         );
 
-         App.DatabaseSettings.SecondaryWindows[_id] = tuple;
 
-         new LocalConfiguration<DatabaseSettings>(App.Profile).Save(App.DatabaseSettings);
 
-     }
 
-     private void Window_Closing(object sender, CancelEventArgs e)
 
-     {
 
-         PanelHost.UnloadPanel(e);
 
-         if (e.Cancel) return;
 
-         if (App.IsClosing)
 
-             return;
 
-         App.DatabaseSettings.SecondaryWindows.Remove(_id);
 
-         new LocalConfiguration<DatabaseSettings>(App.Profile).Save(App.DatabaseSettings);
 
-     }
 
-     private void Window_LocationChanged(object sender, EventArgs e)
 
-     {
 
-         if (bLoaded)
 
-             SaveSettings();
 
-     }
 
-     private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
 
-     {
 
-         if (bLoaded)
 
-             SaveSettings();
 
-     }
 
-     #endregion
 
-     public void CreatePanelAction(PanelAction action)
 
-     {
 
-         var button = new Button
 
-         {
 
-             Header = action.Caption,
 
-             LargeIcon = action.Image.AsBitmapImage()
 
-         };
 
-         button.Click += (o, e) => action.Execute();
 
-         if (action.Menu is not null)
 
-         {
 
-             button.ContextMenu = action.Menu;
 
-         }
 
-         Actions.Items.Add(button);
 
-         CurrentModules.Add(button);
 
-         ActionsSeparator.Visibility = Visibility.Visible;
 
-     }
 
-     public void CreateReport(PanelAction action)
 
-     {
 
-         Print.Visibility = Visibility.Visible;
 
-         var button = new Button
 
-         {
 
-             Header = action.Caption,
 
-             LargeIcon = action.Image.AsBitmapImage()
 
-         };
 
-         if (action.Menu is not null)
 
-         {
 
-             button.ContextMenu = action.Menu;
 
-         }
 
-         button.Click += (o, e) => action.Execute();
 
-         Print.Items.Add(button);
 
-     }
 
-     private void Setup_Click(object sender, RoutedEventArgs e)
 
-     {
 
-         var menu = new ContextMenu();
 
-         PanelHost.InitialiseSetupMenu(menu);
 
-         menu.IsOpen = true;
 
-     }
 
-     public void ClearActions()
 
-     {
 
-         foreach (var module in CurrentModules)
 
-         {
 
-             if (module.Parent is Fluent.RibbonGroupBox bar)
 
-                 bar.Items.Remove(module);
 
-         }
 
-         CurrentModules.Clear();
 
-         ActionsSeparator.Visibility = Visibility.Collapsed;
 
-     }
 
-     public void ClearReports()
 
-     {
 
-         Print.Items.Clear();
 
-         Print.Visibility = Visibility.Visible;
 
-     }
 
-     public void Heartbeat()
 
-     {
 
-         PanelHost.Heartbeat();
 
-     }
 
- }
 
 
  |