コード例 #1
0
        public static void ExportRouteFiles(
            IMessageDisplay view,
            RouteGroup Route,
            IEnumerable <ExportCommand> cmds,
            AirportManager airportList)
        {
            if (Route == null)
            {
                view.ShowMessage("Please find or analyze a route first.", MessageLevel.Info);
                return;
            }

            var writer = new FileExporter(Route.Expanded, airportList, cmds);
            IEnumerable <FileExporter.Status> reports = null;

            try
            {
                reports = writer.Export();
            }
            catch (Exception ex)
            {
                view.ShowMessage(ex.Message, MessageLevel.Warning);
                return;
            }

            ShowReports(view, reports.ToList());
        }
コード例 #2
0
 /// <summary>
 /// Event handler called when a gamer joins the session.
 /// Displays a notification message.
 /// </summary>
 void GamerJoined(object sender, GamerJoinedEventArgs e)
 {
     if (notifyWhenPlayersJoinOrLeave)
     {
         messageDisplay.ShowMessage(Resources.MessageGamerJoined,
                                    e.Gamer.Gamertag);
     }
 }
コード例 #3
0
        /// <summary>
        /// Event handler called when a gamer joins the session.
        /// Displays a notification message.
        /// </summary>
        void GamerJoined(object sender, GamerJoinedEventArgs e)
        {
            int gamerIndex = networkSession.AllGamers.IndexOf(e.Gamer);

            e.Gamer.Tag = new Player(Game.Content, 0);

            if (notifyWhenPlayersJoinOrLeave)
            {
                messageDisplay.ShowMessage(Resources.MessageGamerJoined,
                                           e.Gamer.Gamertag);
            }
        }
コード例 #4
0
        public static void ExportRouteFiles(
            IMessageDisplay view,
            RouteGroup Route,
            IEnumerable <ExportCommand> cmds,
            MultiMap <string, Navaid> Navaids,
            AirportManager airportList,
            ExportMenu menu)
        {
            if (Route == null)
            {
                view.ShowMessage("Please find or analyze a route first.", MessageLevel.Info);
                return;
            }

            using (var frm = GetForm(new Size(1, 1)))
            {
                menu.Location    = new Point(0, 0);
                menu.Route       = Route;
                menu.Navaids     = Navaids;
                menu.AirportList = airportList;

                frm.AutoSizeMode    = AutoSizeMode.GrowAndShrink;
                frm.AutoSize        = true;
                frm.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                frm.Controls.Add(menu);
                frm.ShowDialog();
                frm.Controls.Remove(menu);
            }
        }
コード例 #5
0
        public static void ShowReports(IMessageDisplay view, List <FileExporter.Status> reports)
        {
            if (!reports.Any())
            {
                view.ShowMessage(
                    "No route file to export. Please set export settings in options page.",
                    MessageLevel.Info);
                return;
            }

            var msg     = new StringBuilder();
            var success = reports.Where(r => r.Successful).ToList();

            if (success.Any())
            {
                msg.AppendLine($"{success.Count} company route(s) exported:");

                foreach (var i in success)
                {
                    msg.AppendLine(i.FilePath);
                }
            }

            var errors = reports.Where(r => !r.Successful).ToList();

            if (errors.Any())
            {
                msg.AppendLine($"\n\nFailed to export {errors.Count} file(s) into:");

                foreach (var j in errors)
                {
                    msg.AppendLine(j.FilePath);
                }
            }

            if (errors.Any(e => e.MayBePermissionIssue))
            {
                msg.AppendLine("\nYou can try to run this application " +
                               "as administrator.");
            }

            view.ShowMessage(
                msg.ToString(),
                errors.Any() ? MessageLevel.Warning : MessageLevel.Info);
        }