Skip to content

Commit 59f9b88

Browse files
committed
Automatic merge of T1.5.1-1088-g264349b1ce and 20 pull requests
- Pull request #891 at 9a1d6b2: Auto save - Pull request #959 at 2452cb0: Fix TrackViewer crash on big zoom value - Pull request #972 at e90a2aa: On Map window color changed switch or signal is not changed - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #882 at 8f695a4: Blueprint/train car operations UI window - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #922 at a3bc9e7: Autopilot for timetable mode - Pull request #953 at a519452: Fix Lights Crash on Corrupt Shapes - Pull request #962 at 46d0472: Fix pantographs on unpowered cars - Pull request #970 at 6fa5eed: feat: Remove unnecessary Windows.Forms usage - Pull request #900 at c27f32d: DMI updates - Pull request #903 at 9dabe97: Downloading route content (Github, zip) - Pull request #799 at dfc715e: Consolidated wind simulation - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #885 at a9b02ac: feat: Add notifications to Menu - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #946 at 91a03af: Advanced track sounds - Pull request #952 at 8347095: Investigation - Pulsing graphics - Pull request #954 at f837ffd: Multiple Track Profiles & Superelevation Improvements - Pull request #968 at a88cb26: Initial build of adding track section identifier for rack railway
22 parents 45f00ca + 264349b + 9a1d6b2 + 2452cb0 + e90a2aa + d00beb9 + 8f695a4 + 1f5ba4c + a3bc9e7 + a519452 + 46d0472 + 6fa5eed + c27f32d + 9dabe97 + dfc715e + f92de76 + a9b02ac + 5866028 + 91a03af + 8347095 + f837ffd + a88cb26 commit 59f9b88

File tree

6 files changed

+184
-193
lines changed

6 files changed

+184
-193
lines changed
1.56 KB
Binary file not shown.

Source/Menu/MainForm.cs

Lines changed: 22 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ void MainForm_Shown(object sender, EventArgs e)
136136
{
137137
var options = Environment.GetCommandLineArgs().Where(a => (a.StartsWith("-") || a.StartsWith("/"))).Select(a => a.Substring(1));
138138
Settings = new UserSettings(options);
139-
NotificationManager = new NotificationManager(this, UpdateManager, Settings);
140139

141140
Cursor = Cursors.Default;
142141

@@ -247,6 +246,13 @@ orderby tool.Text
247246
}
248247
else
249248
buttonDocuments.Enabled = false;
249+
250+
NotificationManager = new NotificationManager(this, UpdateManager, Settings, panelDetails
251+
, (Image)Resources.GetObject("Notification_previous")
252+
, (Image)Resources.GetObject("Notification_next")
253+
, (Image)Resources.GetObject("Notification_first")
254+
, (Image)Resources.GetObject("Notification_last")
255+
);
250256
}
251257

252258
ShowEnvironment();
@@ -1569,13 +1575,6 @@ void comboBoxTimetable_EnabledChanged(object sender, EventArgs e)
15691575
}
15701576

15711577
#region NotificationPages
1572-
public int CurrentNotificationNo = 0;
1573-
private bool firstVisible = true;
1574-
private bool previousVisible = false;
1575-
private bool lastVisible = false;
1576-
private bool nextVisible = true;
1577-
1578-
15791578
private void pbNotificationsNone_Click(object sender, EventArgs e)
15801579
{
15811580
ToggleNotificationPages();
@@ -1606,111 +1605,51 @@ private void ToggleNotificationPages()
16061605

16071606
private void FiddleNewNotificationPageCount()
16081607
{
1609-
//NotificationManager.LastPageViewed = 1;
1608+
//NotificationManager.LastPageViewed = 1; //TODO
16101609
UpdateNotificationPageAlert();
16111610
}
16121611

1613-
public void UpdateNotificationPageAlert()
1614-
{
1615-
if (NotificationManager.LastPageViewed >= NotificationManager.NewPageCount)
1616-
{
1617-
pbNotificationsSome.Visible = false;
1618-
lblNotificationCount.Visible = false;
1619-
}
1620-
}
1621-
1622-
void ShowNotificationPages()
1612+
public void ShowNotificationPages()
16231613
{
16241614
Win32.LockWindowUpdate(Handle);
16251615
ClearPanel();
16261616
NotificationManager.PopulatePage();
1627-
var notificationPage = GetCurrentNotificationPage();
1628-
notificationPage.FlowNDetails();
1617+
UpdateNotificationPageAlert();
1618+
NotificationManager.Page.FlowNDetails();
16291619
Win32.LockWindowUpdate(IntPtr.Zero);
16301620
}
16311621

1632-
/// <summary>
1633-
/// INCOMPLETE
1634-
/// </summary>
1635-
/// <returns></returns>
1636-
NotificationPage GetCurrentNotificationPage()
1637-
{
1638-
return NotificationManager.Page;
1639-
}
1640-
1641-
/// <summary>
1642-
/// Returns a new notificationPage with default images and label
1643-
/// </summary>
1644-
/// <returns></returns>
1645-
public NotificationPage CreateNotificationPage()
1646-
// Located in MainForm to get access to MainForm.Resources
1622+
public void UpdateNotificationPageAlert()
16471623
{
1648-
var previousImage = (Image)Resources.GetObject("Notification_previous");
1649-
var nextImage = (Image)Resources.GetObject("Notification_next");
1650-
var firstImage = (Image)Resources.GetObject("Notification_first");
1651-
var lastImage = (Image)Resources.GetObject("Notification_last");
1652-
var pageCount = $"{CurrentNotificationNo + 1}/{NotificationManager.Notifications.NotificationList.Count}";
1653-
return new NotificationPage(this, panelDetails, nextImage, previousImage, firstImage, lastImage, pageCount,
1654-
previousVisible, firstVisible, nextVisible, lastVisible);
1624+
if (NotificationManager.LastPageViewed >= NotificationManager.NewPageCount)
1625+
{
1626+
pbNotificationsSome.Visible = false;
1627+
lblNotificationCount.Visible = false;
1628+
}
16551629
}
16561630

16571631
// 3 should be enough, but is there a way to get unlimited buttons?
16581632
public void Button0_Click(object sender, EventArgs e)
16591633
{
1660-
GetCurrentNotificationPage().DoButton(UpdateManager, 0);
1634+
NotificationManager.Page.DoButton(UpdateManager, 0);
16611635
}
16621636
public void Button1_Click(object sender, EventArgs e)
16631637
{
1664-
GetCurrentNotificationPage().DoButton(UpdateManager, 1);
1638+
NotificationManager.Page.DoButton(UpdateManager, 1);
16651639
}
16661640
public void Button2_Click(object sender, EventArgs e)
16671641
{
1668-
GetCurrentNotificationPage().DoButton(UpdateManager, 2);
1642+
NotificationManager.Page.DoButton(UpdateManager, 2);
16691643
}
16701644

16711645
public void Next_Click(object sender, EventArgs e)
16721646
{
1673-
ChangePage(1);
1674-
// GetCurrentNotificationPage().DoNext(1);
1647+
NotificationManager.ChangePage(1);
16751648
}
16761649

16771650
public void Previous_Click(object sender, EventArgs e)
16781651
{
1679-
ChangePage(-1);
1680-
//GetCurrentNotificationPage().DoNext(-1);
1681-
}
1682-
1683-
private void ChangePage(int step)
1684-
{
1685-
SetVisibility(step);
1686-
CurrentNotificationNo += step;
1687-
ShowNotificationPages();
1688-
}
1689-
1690-
private void SetVisibility(int step)
1691-
{
1692-
if (step < 0)
1693-
{
1694-
if (CurrentNotificationNo + step <= 0)
1695-
{
1696-
previousVisible = false;
1697-
firstVisible = true;
1698-
return;
1699-
}
1700-
}
1701-
else
1702-
{
1703-
if (CurrentNotificationNo + step >= NotificationManager.Notifications.NotificationList.Count - 1)
1704-
{
1705-
nextVisible = false;
1706-
lastVisible = true;
1707-
return;
1708-
}
1709-
}
1710-
nextVisible = true;
1711-
lastVisible = false;
1712-
previousVisible = true;
1713-
firstVisible = false;
1652+
NotificationManager.ChangePage(-1);
17141653
}
17151654

17161655
#endregion NotificationPages

0 commit comments

Comments
 (0)