Beispiel #1
0
        /// <summary>
        /// Popup a dialog to enable to user to edit the path meta data
        /// </summary>
        /// <param name="popupX">The screen x-location of where the popup needs to be placed</param>
        /// <param name="popupY">The screen y-location of where the popup needs to be placed</param>
        public void EditMetaData(int popupX, int popupY)
        {
            string[]           metadata       = { CurrentTrainPath.PathId, CurrentTrainPath.PathName, CurrentTrainPath.PathStart, CurrentTrainPath.PathEnd };
            bool               isPlayerPath   = (CurrentTrainPath.PathFlags & PathFlags.NotPlayerPath) == 0;
            PathMetadataDialog metadataDialog = new PathMetadataDialog(metadata, isPlayerPath)
            {
                Left = popupX,
                Top  = popupY
            };

            TrackViewer.Localize(metadataDialog);
            if (metadataDialog.ShowDialog() == true)
            {
                metadata = metadataDialog.GetMetadata();
                CurrentTrainPath.PathId    = metadata[0];
                CurrentTrainPath.PathName  = metadata[1];
                CurrentTrainPath.PathStart = metadata[2];
                CurrentTrainPath.PathEnd   = metadata[3];

                isPlayerPath = (metadata[4] == true.ToString());
                if (isPlayerPath)
                {
                    CurrentTrainPath.PathFlags &= ~PathFlags.NotPlayerPath; // unset the nonplayerpath flag
                }
                else
                {
                    CurrentTrainPath.PathFlags |= PathFlags.NotPlayerPath; // set the nonplayerpath flag
                }
            }
        }
Beispiel #2
0
        private void menuSearchTrackItemRoad_Click(object sender, RoutedEventArgs e)
        {
            SearchControl searchControl = new SearchControl(trackViewer, SearchableItem.TrackItemRoad);

            TrackViewer.Localize(searchControl);
            searchControl.ShowDialog();
        }
Beispiel #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 public DrawPathChart()
 {
     chartWindow = new PathChartWindow
     {
         OnJsonSaveClick = OnJsonSave
     };
     TrackViewer.Localize(chartWindow);
 }
Beispiel #4
0
        /// <summary>
        /// Call this when adding a new label
        /// </summary>
        /// <param name="mouseX">Current X-location of the mouse to determine popup location</param>
        /// <param name="mouseY">Current Y-location of the mouse to determine popu location</param>
        internal void AddLabel(int mouseX, int mouseY)
        {
            var labelInputPopup = new EditLabel("<label>", mouseX, mouseY,
                                                (newLabelText) => labels.Add(drawArea.MouseLocation, newLabelText),
                                                allowDelete: false);

            TrackViewer.Localize(labelInputPopup);
            labelInputPopup.ShowDialog();
        }
Beispiel #5
0
        /// <summary>
        /// Callback that is called when the user clicks on the menuitem connected to a new label
        /// </summary>
        /// <param name="oldLabel">The old label that needs to be replaced</param>
        /// <param name="mouseX">Current X-location of the mouse to determine popup location</param>
        /// <param name="mouseY">Current Y-location of the mouse to determine popu location</param>
        private void ModifyLabel(StorableLabel oldLabel, int mouseX, int mouseY)
        {
            var labelInputPopup = new EditLabel(oldLabel.LabelText, mouseX, mouseY,
                                                (newLabelText) =>
            {
                if (newLabelText == null)
                {
                    labels.Delete(oldLabel);
                }
                else
                {
                    var newLabel = new StorableLabel(oldLabel.WorldLocation, newLabelText);
                    labels.Replace(oldLabel, newLabel);
                }
            }, allowDelete: true);

            TrackViewer.Localize(labelInputPopup);
            labelInputPopup.ShowDialog();
        }
Beispiel #6
0
 private void menuShowOtherPaths_Click(object sender, RoutedEventArgs e)
 {
     otherPathsWindow = new OtherPathsWindow(trackViewer.DrawMultiplePaths);
     TrackViewer.Localize(otherPathsWindow);
     otherPathsWindow.Show();
 }