예제 #1
0
        private void AttribDelete_Click(object sender, RoutedEventArgs e)
        {
            KmlAttrib attrib = ((sender as MenuItem).DataContext as KmlAttrib);

            if (DlgConfirmation.Show("Do your really want to delete this attribute?\n" + attrib, "DELETE attribue", Icons.Delete))
            {
                attrib.Delete();
                // View will be refreshed in parent's ChildrenChanged event
            }
        }
예제 #2
0
        private void KerbalSendHome_Click(object sender, RoutedEventArgs e)
        {
            KmlKerbal kerbal = (sender as MenuItem).DataContext as KmlKerbal;

            if (DlgConfirmation.Show("Do you really want to send " + kerbal.Name + " home to astronaut complex?\n\n" +
                                     "- The kerbal will be removed from assigned crew part\n" +
                                     "- State will be set to 'Available'\n" +
                                     "- Experience or contract progress may get lost",
                                     "Send home kerbal", (sender as MenuItem).Icon as Image))
            {
                kerbal.SendHome();
            }
        }
예제 #3
0
        private void VesselToLKO_Click(object sender, RoutedEventArgs e)
        {
            KmlVessel vessel = (sender as MenuItem).DataContext as KmlVessel;

            if (DlgConfirmation.Show("Do you really want to send " + vessel.Name + " to low kerbin orbit?\n\n" +
                                     "- The vessel situation and orbit data will be changed\n" +
                                     "- Orbit height will be 80km\n" +
                                     "- Do not use when your kerbin is scaled bigger (RSS)",
                                     "Send vessel to LKO", (sender as MenuItem).Icon as Image))
            {
                vessel.SendToKerbinOrbit(80000.0);
            }
        }
예제 #4
0
        /// <summary>
        /// Show a dialog window with given title, message and image.
        /// </summary>
        /// <param name="message">The message to show</param>
        /// <param name="title">The window title</param>
        /// <param name="image">The image for the window icon</param>
        /// <returns>True if "Ok" was clicked, false otherwise</returns>
        public static bool Show(string message, string title, Image image)
        {
            DlgConfirmation dlg = new DlgConfirmation(message, title, image);

            return(dlg.ShowDialog() == true);
        }
예제 #5
0
        private void NodeDelete_Click(object sender, RoutedEventArgs e)
        {
            KmlNode node        = ((sender as MenuItem).DataContext as KmlNode);
            string  nodeName    = "node";
            string  specialText = "";

            if (node is KmlKerbal)
            {
                nodeName = "kerbal";
                if ((node as KmlKerbal).AssignedPart != null)
                {
                    specialText = "\n\n- The kerbal will be removed from assigned crew part";
                }
            }
            else if (node is KmlVessel)
            {
                nodeName = "vessel";
                if ((node as KmlVessel).AssignedCrew.Count > 0)
                {
                    specialText = "\n\n- Kerbal crew will be send home to astronaut complex\n" +
                                  "- Their state will be set to 'Available'\n" +
                                  "- Experience or contract progress may get lost";
                }
            }
            else if (node is KmlPart)
            {
                nodeName    = "part";
                specialText = "\n\n- Part will be removed from vessel structure\n" +
                              "- Attachment indices will be updated";
                if (node.Parent is KmlVessel)
                {
                    foreach (KmlKerbal kerbal in (node.Parent as KmlVessel).AssignedCrew)
                    {
                        if (kerbal.AssignedPart == node)
                        {
                            specialText += "\n- Kerbal crew will be send home to astronaut complex\n" +
                                           "- Their state will be set to 'Available'\n" +
                                           "- Experience or contract progress may get lost";
                            break;
                        }
                    }
                }
            }
            if (DlgConfirmation.Show("Do you really want to delete this " + nodeName + " and all its content?\n" +
                                     node + specialText, "DELETE " + nodeName, Icons.Delete))
            {
                node.Delete();
                // View will be refreshed in parent's ChildrenChanged event
                // Special case: PartGraph is currently shown
                if (Parent is GuiVesselsPartGraphNode)
                {
                    GuiVesselsPartGraphNode pgn = (GuiVesselsPartGraphNode)Parent;
                    if (pgn.Parent is Canvas)
                    {
                        Canvas cnv = (Canvas)pgn.Parent;
                        foreach (var line in pgn.Lines)
                        {
                            cnv.Children.Remove(line);
                        }
                        cnv.Children.Remove(pgn);
                    }
                }
            }
        }