Added logic to return to the previously selected tab page on a detail control,
but only if the control has a tab control and the save button was hit. In this case a complete reload happens.
This commit is contained in:
parent
83d57328fc
commit
d1c131c52b
@ -192,6 +192,10 @@ namespace ENI2
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
public virtual int SelectedTabIndex { get; set; } = -1;
|
||||
|
||||
#endregion
|
||||
|
||||
#region event handling for control content changes (signal dirty etc)
|
||||
|
||||
protected void RegisterTextboxChange(TextBox textBox, Message.NotificationClass notificationClass)
|
||||
@ -345,9 +349,7 @@ namespace ENI2
|
||||
GlobalStructures.FilterCombobox(cmb, e.Key);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region IHighlightControlContainer implementation
|
||||
|
||||
|
||||
@ -485,6 +485,7 @@ namespace ENI2
|
||||
{
|
||||
|
||||
Util.UIHelper.SetBusyState();
|
||||
int currentMainTabIndex = -1;
|
||||
|
||||
if (this.detailView.Children[0] is DetailBaseControl currentControl)
|
||||
{
|
||||
@ -499,10 +500,24 @@ namespace ENI2
|
||||
// ggf. hat sich die Ticketnr geändert..
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(currentControl.Core);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.DetailControl_RequestReload(this.Core.Id.Value);
|
||||
currentMainTabIndex = currentControl.SelectedTabIndex;
|
||||
}
|
||||
|
||||
this.DetailControl_RequestReload(this.Core.Id.Value);
|
||||
|
||||
System.Action<int> SetTabAction = (int x) =>
|
||||
{
|
||||
// this hopefully happens *after* the view was completely reloaded
|
||||
if (this.detailView.Children[0] is DetailBaseControl currentNewControl)
|
||||
{
|
||||
currentNewControl.SelectedTabIndex = x;
|
||||
}
|
||||
};
|
||||
|
||||
if (currentMainTabIndex >= 0)
|
||||
Dispatcher.BeginInvoke(SetTabAction, currentMainTabIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveMessage(Message message)
|
||||
@ -553,6 +568,7 @@ namespace ENI2
|
||||
{
|
||||
|
||||
Util.UIHelper.SetBusyState();
|
||||
int currentMainTabIndex = -1;
|
||||
|
||||
foreach (Message message in this._messages)
|
||||
{
|
||||
@ -564,12 +580,27 @@ namespace ENI2
|
||||
{
|
||||
// ggf. hat sich die Ticketnr geändert..
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(currentControl.Core);
|
||||
currentMainTabIndex = currentControl.SelectedTabIndex;
|
||||
}
|
||||
|
||||
this.buttonSaveAll.Visibility = Visibility.Hidden;
|
||||
this.buttonSave.Visibility = Visibility.Hidden;
|
||||
|
||||
this.DetailControl_RequestReload(this.Core.Id.Value);
|
||||
|
||||
System.Action<int> SetTabAction = (int x) =>
|
||||
{
|
||||
// this hopefully happens *after* the view was completely reloaded
|
||||
if (this.detailView.Children[0] is DetailBaseControl currentNewControl)
|
||||
{
|
||||
currentNewControl.SelectedTabIndex = x;
|
||||
}
|
||||
};
|
||||
|
||||
if(currentMainTabIndex >= 0)
|
||||
Dispatcher.BeginInvoke(SetTabAction, currentMainTabIndex);
|
||||
}
|
||||
this.DetailControl_RequestReload(this.Core.Id.Value);
|
||||
|
||||
}
|
||||
|
||||
private void DetailControl_NotificationClassChanged(Message.NotificationClass? notificationClass)
|
||||
|
||||
@ -244,7 +244,13 @@ namespace ENI2.DetailViewControls
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
public override int SelectedTabIndex
|
||||
{
|
||||
get { return this.mainFrame.SelectedIndex; }
|
||||
set { this.mainFrame.SelectedIndex = value; }
|
||||
}
|
||||
|
||||
#region Grid copy handlers
|
||||
|
||||
|
||||
@ -197,6 +197,12 @@ namespace ENI2.DetailViewControls
|
||||
this._initialized = true;
|
||||
}
|
||||
|
||||
public override int SelectedTabIndex
|
||||
{
|
||||
get { return this.tabControlPositions.SelectedIndex; }
|
||||
set { this.tabControlPositions.SelectedIndex = value; }
|
||||
}
|
||||
|
||||
#region SetEnabled
|
||||
|
||||
public override void SetEnabled(bool enabled)
|
||||
|
||||
@ -130,6 +130,12 @@ namespace ENI2.DetailViewControls
|
||||
|
||||
}
|
||||
|
||||
public override int SelectedTabIndex
|
||||
{
|
||||
get { return this.mainFrame.SelectedIndex; }
|
||||
set { this.mainFrame.SelectedIndex = value; }
|
||||
}
|
||||
|
||||
#region SetEnabled
|
||||
|
||||
public override void SetEnabled(bool enabled)
|
||||
|
||||
@ -116,6 +116,12 @@ namespace ENI2.DetailViewControls
|
||||
|
||||
}
|
||||
|
||||
public override int SelectedTabIndex
|
||||
{
|
||||
get { return this.mainFrame.SelectedIndex; }
|
||||
set { this.mainFrame.SelectedIndex = value; }
|
||||
}
|
||||
|
||||
#region SetEnabled
|
||||
|
||||
public override void SetEnabled(bool enabled)
|
||||
|
||||
@ -187,6 +187,12 @@ namespace ENI2.DetailViewControls
|
||||
|
||||
}
|
||||
|
||||
public override int SelectedTabIndex
|
||||
{
|
||||
get { return this.mainFrame.SelectedIndex; }
|
||||
set { this.mainFrame.SelectedIndex = value; }
|
||||
}
|
||||
|
||||
#region Waste receipt grid event handler
|
||||
|
||||
private async void DataGridWasteReceipt_CreateRequested()
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
</col:ArrayList>
|
||||
</UserControl.Resources>
|
||||
<GroupBox Name="portCallGroupBox" Header="{x:Static p:Resources.text2PortCall}">
|
||||
<TabControl>
|
||||
<TabControl x:Name="mainTabControl">
|
||||
<TabItem Header="{x:Static p:Resources.textTab21}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
|
||||
@ -204,15 +204,10 @@ namespace ENI2.SheetDisplayControls
|
||||
|
||||
}
|
||||
|
||||
private void CheckBoxValidExemption_Checked(object sender, RoutedEventArgs e)
|
||||
public override int SelectedTabIndex
|
||||
{
|
||||
bool on = !(this.checkBoxValidExemption.IsChecked ?? false);
|
||||
this.checkBoxAccurateCorrectDetails.IsEnabled = on;
|
||||
this.locodeCtrlLastWastePort.IsEnabled = on;
|
||||
this.datePickerDateLastDisposal.IsEnabled = on;
|
||||
this.textBoxWasteDisposalServiceProviders.IsEnabled = on;
|
||||
this.gridWasteControls.IsEnabled = on;
|
||||
this.dataGridWaste.IsEnabled = on;
|
||||
get { return this.mainTabControl.SelectedIndex; }
|
||||
set { this.mainTabControl.SelectedIndex = value; }
|
||||
}
|
||||
|
||||
public override void SetEnabled(bool enabled)
|
||||
@ -270,7 +265,17 @@ namespace ENI2.SheetDisplayControls
|
||||
this.RegisterTextboxChange(this.textBoxWasteDisposalServiceProviders, Message.NotificationClass.WAS);
|
||||
this.RegisterDatePickerChange(this.datePickerDateLastDisposal, Message.NotificationClass.WAS);
|
||||
|
||||
}
|
||||
|
||||
private void CheckBoxValidExemption_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
bool on = !(this.checkBoxValidExemption.IsChecked ?? false);
|
||||
this.checkBoxAccurateCorrectDetails.IsEnabled = on;
|
||||
this.locodeCtrlLastWastePort.IsEnabled = on;
|
||||
this.datePickerDateLastDisposal.IsEnabled = on;
|
||||
this.textBoxWasteDisposalServiceProviders.IsEnabled = on;
|
||||
this.gridWasteControls.IsEnabled = on;
|
||||
this.dataGridWaste.IsEnabled = on;
|
||||
}
|
||||
|
||||
private void buttonSearchPortArea_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="1050" d:DesignWidth="800">
|
||||
<GroupBox Name="shipDataGroupBox" Header="{x:Static p:Resources.text3PreArrival}">
|
||||
<TabControl>
|
||||
<TabControl x:Name="mainTabControl">
|
||||
<TabItem Header="{x:Static p:Resources.textTab51}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
|
||||
@ -123,6 +123,12 @@ namespace ENI2.SheetDisplayControls
|
||||
this.shipDataGroupBox.IsEnabled = enabled;
|
||||
}
|
||||
|
||||
public override int SelectedTabIndex
|
||||
{
|
||||
get { return this.mainTabControl.SelectedIndex; }
|
||||
set { this.mainTabControl.SelectedIndex = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region event handler
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
d:DesignHeight="1150" d:DesignWidth="800">
|
||||
|
||||
<GroupBox Name="voyageGroupBox" Header="{x:Static p:Resources.textVoyage}">
|
||||
<TabControl>
|
||||
<TabControl x:Name="mainTabControl">
|
||||
<TabItem Header="{x:Static p:Resources.textTab11}">
|
||||
<ScrollViewer PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
|
||||
<Grid>
|
||||
|
||||
@ -199,6 +199,12 @@ namespace ENI2.SheetDisplayControls
|
||||
this.voyageGroupBox.IsEnabled = enabled;
|
||||
}
|
||||
|
||||
public override int SelectedTabIndex
|
||||
{
|
||||
get { return this.mainTabControl.SelectedIndex; }
|
||||
set { this.mainTabControl.SelectedIndex = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region event handler
|
||||
|
||||
Loading…
Reference in New Issue
Block a user