CTCOfficeGUI.MainScreen.OnLoadTrackLayoutClicked C# (CSharp) Method

OnLoadTrackLayoutClicked() private method

User selected the load track layout menu item
private OnLoadTrackLayoutClicked ( object sender, EventArgs e ) : void
sender object Sender of the event
e System.EventArgs Event arguments
return void
        private void OnLoadTrackLayoutClicked(object sender, EventArgs e)
        {
            //Show file dialog to select the track layout
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.InitialDirectory = System.IO.Directory.GetCurrentDirectory();
            dialog.CheckFileExists = true;
            dialog.CheckPathExists = true;
            dialog.RestoreDirectory = true;
            dialog.Multiselect = false;
            dialog.Title = "Select Track Layout";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string filename = dialog.FileName;
                if (Initialize(filename))
                {
                    dialog.Dispose();
                    dialog = null;
                }
                else
                {
                    ShowOKPopup("Error", "Could not load track layout", OnPopupAcknowledged);
                }
            }
        }