diff --git a/ENI-2/ENI2/ENI2/anmeldungenControl.xaml b/ENI-2/ENI2/ENI2/AnmeldungenControl.xaml similarity index 93% rename from ENI-2/ENI2/ENI2/anmeldungenControl.xaml rename to ENI-2/ENI2/ENI2/AnmeldungenControl.xaml index 7d30aac1..caec8fad 100644 --- a/ENI-2/ENI2/ENI2/anmeldungenControl.xaml +++ b/ENI-2/ENI2/ENI2/AnmeldungenControl.xaml @@ -7,7 +7,8 @@ mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> - + diff --git a/ENI-2/ENI2/ENI2/AnmeldungenControl.xaml.cs b/ENI-2/ENI2/ENI2/AnmeldungenControl.xaml.cs index c1d5a49f..ba54757b 100644 --- a/ENI-2/ENI2/ENI2/AnmeldungenControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/AnmeldungenControl.xaml.cs @@ -14,6 +14,8 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using bsmd.database; + namespace ENI2 { /// @@ -21,9 +23,64 @@ namespace ENI2 /// public partial class AnmeldungenControl : UserControl { + + #region Construction + public AnmeldungenControl() { InitializeComponent(); } + + #endregion + + public event MessageCore.MessageCoreSelectedHandler MessageCoreSelected; + + #region event handling / selection + + private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) + { + if(sender != null) + { + DataGrid grid = sender as DataGrid; + if((grid != null) && (grid.SelectedItems != null) && (grid.SelectedItems.Count == 1)) + { + DataGridRow dgr = grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem) as DataGridRow; + MessageCore selectedCore = grid.SelectedItem as MessageCore; + this.DisplayCore(selectedCore); + } + } + } + + private void DisplayCore(MessageCore core) + { + if(core != null) + { + this.OnMessageCoreSelected(core); + } + } + + protected void OnMessageCoreSelected(MessageCore aMessageCore) + { + if((this.MessageCoreSelected != null) && (aMessageCore != null)) + { + this.MessageCoreSelected(aMessageCore); + } + } + + protected override void OnPreviewKeyDown(KeyEventArgs e) + { + if ((e.Key == Key.Return) || (e.Key == Key.Enter)) + { + MessageCore selectedCore = dataGrid.SelectedItem as MessageCore; + this.DisplayCore(selectedCore); + } + else + { + base.OnPreviewKeyDown(e); + } + } + + #endregion + } } diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config index b793453c..85221ef7 100644 --- a/ENI-2/ENI2/ENI2/App.config +++ b/ENI-2/ENI2/ENI2/App.config @@ -17,7 +17,7 @@ Sample license text. - Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False + Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False diff --git a/ENI-2/ENI2/ENI2/DetailBaseControl.cs b/ENI-2/ENI2/ENI2/DetailBaseControl.cs new file mode 100644 index 00000000..7ef9e62a --- /dev/null +++ b/ENI-2/ENI2/ENI2/DetailBaseControl.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2017 schick Informatik +// Description: +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; + +using bsmd.database; + +namespace ENI2 +{ + public class DetailBaseControl : UserControl + { + + public MessageCore Core { get; set; } + + public List Messages { get; set; } + + } +} + diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml b/ENI-2/ENI2/ENI2/DetailRootControl.xaml new file mode 100644 index 00000000..88c76e54 --- /dev/null +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs new file mode 100644 index 00000000..f70da2ca --- /dev/null +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs @@ -0,0 +1,94 @@ +// Copyright (c) 2017 schick Informatik +// Description: Control für die Auftragsbearbeitung (Rahmen) +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +using bsmd.database; +using ENI2.DetailViewControls; + +namespace ENI2 +{ + /// + /// Interaction logic for DetailRootControl.xaml + /// + public partial class DetailRootControl : UserControl + { + private MessageCore _core; + private List _listBoxList = new List(); + private List _messages; + + public DetailRootControl(MessageCore aCore) + { + _core = aCore; + InitializeComponent(); + shipNameLabel.Content = aCore.Shipname; + displayIdLabel.Content = aCore.DisplayId; + + // Listbox befüllen + this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Overview", MessageGroupControlType = typeof(OverViewDetailControl), ImagePath = "Resources/documents.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Port Call", MessageGroupControlType = typeof(DetailBaseControl), ImagePath = "Resources/eye_blue.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Port Notification", MessageGroupControlType = typeof(DetailBaseControl), ImagePath = "Resources/anchor.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Waste", MessageGroupControlType = typeof(DetailBaseControl), ImagePath = "Resources/garbage.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Arrival Notification", MessageGroupControlType = typeof(DetailBaseControl), ImagePath = "Resources/arrow_down_right_red.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Security", MessageGroupControlType = typeof(DetailBaseControl), ImagePath = "Resources/shield_yellow.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = "PSC 72h", MessageGroupControlType = typeof(DetailBaseControl), ImagePath = "Resources/alarmclock.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Maritime Health Declaration", MessageGroupControlType = typeof(DetailBaseControl), ImagePath = "Resources/medical_bag.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Ship Data", MessageGroupControlType = typeof(DetailBaseControl), ImagePath = "Resources/containership.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Border Police", MessageGroupControlType = typeof(DetailBaseControl), ImagePath = "Resources/policeman_german.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Departure Notification", MessageGroupControlType = typeof(DetailBaseControl), ImagePath = "Resources/arrow_up_right_green.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Dangerous Goods Arrival", MessageGroupControlType = typeof(DetailBaseControl), ImagePath = "Resources/sign_warning_radiation.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Dangerous Goods Departure", MessageGroupControlType = typeof(DetailBaseControl), ImagePath = "Resources/sign_warning_radiation.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = "Towage", MessageGroupControlType = typeof(DetailBaseControl), ImagePath = "Resources/ship2.png" }); + + + this.listBoxMessages.ItemsSource = this._listBoxList; + + _messages = DBManager.Instance.GetMessagesForCore(_core, DBManager.MessageLoad.ALL); + + } + + #region class MessageGroup + + /// + /// Klasse um ein Element der Listbox darzustellen (notwendig für das Databinding) + /// + public class MessageGroup + { + public Type MessageGroupControlType { get; set; } + public string MessageGroupName { get; set; } + public string ImagePath { get; set; } + } + + #endregion + + + private void listBoxMessages_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if(listBoxMessages.SelectedItem != null) + { + MessageGroup mg = this.listBoxMessages.SelectedItem as MessageGroup; + // create control instance for display: + DetailBaseControl detailControl = (DetailBaseControl) Activator.CreateInstance(mg.MessageGroupControlType); + detailControl.Core = _core; + detailControl.Messages = _messages; + // plug it in ;-) + detailView.Children.Clear(); + detailView.Children.Add(detailControl); + } + } + } +} diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml new file mode 100644 index 00000000..31bc139c --- /dev/null +++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs new file mode 100644 index 00000000..ff0a9241 --- /dev/null +++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs @@ -0,0 +1,35 @@ +// Copyright (c) 2017 schick Informatik +// Description: +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +using bsmd.database; +using ENI2; + +namespace ENI2.DetailViewControls +{ + /// + /// Interaction logic for OverViewDetailControl.xaml + /// + public partial class OverViewDetailControl : DetailBaseControl + { + public OverViewDetailControl() + { + InitializeComponent(); + } + } +} diff --git a/ENI-2/ENI2/ENI2/ENI2.csproj b/ENI-2/ENI2/ENI2/ENI2.csproj index d34ca813..c7174de4 100644 --- a/ENI-2/ENI2/ENI2/ENI2.csproj +++ b/ENI-2/ENI2/ENI2/ENI2.csproj @@ -25,16 +25,16 @@ false false true - http://smnsw01.bsmd.local/eni2.publish/ - http://smnsw01.bsmd.local/eni2.publish/ + http://192.168.2.4/eni2.publish/ + http://192.168.2.4/eni2.publish/ http://www.textbausteine.net/ ENI2 Informatikbüro Daniel Schick 3.5.1.0 true publish.html - 2 - 3.5.2.%2a + 1 + 3.5.3.%2a false true true @@ -148,6 +148,13 @@ Properties\AssemblyProjectKeyInfo.cs + + + DetailRootControl.xaml + + + OverViewDetailControl.xaml + SucheControl.xaml @@ -159,6 +166,14 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -203,7 +218,6 @@ - @@ -246,6 +260,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +