Exemplo n.º 1
1
		/// <summary>
		/// The constructor is private: loading screens should
		/// be activated via the static Load method instead.
		/// </summary>
		private LoadingScreen (ScreenManager screenManager,bool loadingIsSlow, 
				GameScreen[] screensToLoad)
			{
			this.loadingIsSlow = loadingIsSlow;
			this.screensToLoad = screensToLoad;

			TransitionOnTime = TimeSpan.FromSeconds (0.5);

			// If this is going to be a slow load operation, create a background
			// thread that will update the network session and draw the load screen
			// animation while the load is taking place.
			if (loadingIsSlow) {
				backgroundThread = new Thread (BackgroundWorkerThread);
				backgroundThreadExit = new ManualResetEvent (false);

				graphicsDevice = screenManager.GraphicsDevice;

				// Look up some services that will be used by the background thread.
				IServiceProvider services = screenManager.Game.Services;

				networkSession = (NetworkSession)services.GetService (
							typeof(NetworkSession));

				messageDisplay = (IMessageDisplay)services.GetService (
							typeof(IMessageDisplay));
			}
		}
Exemplo n.º 2
0
        /// <summary>
        /// The constructor is private: loading screens should
        /// be activated via the static Load method instead.
        /// </summary>
        private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow,
                              GameScreen[] screensToLoad)
        {
            this.loadingIsSlow = loadingIsSlow;
            this.screensToLoad = screensToLoad;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);

            // If this is going to be a slow load operation, create a background
            // thread that will update the network session and draw the load screen
            // animation while the load is taking place.
            if (loadingIsSlow)
            {
                backgroundThread = new Thread(BackgroundWorkerThread);
                backgroundThreadExit = new ManualResetEvent(false);

                graphicsDevice = screenManager.GraphicsDevice;

                // Look up some services that will be used by the background thread.
                IServiceProvider services = screenManager.Game.Services;

                networkSession = (NetworkSession)services.GetService(
                                                            typeof(NetworkSession));

                messageDisplay = (IMessageDisplay)services.GetService(
                                                            typeof(IMessageDisplay));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        public XmlView()
        {
            InitializeComponent();

            xml            = new TextElement(richTextBox1);
            messageDisplay = new MessageDisplay("NUnit Project Editor");
        }
Exemplo n.º 4
0
        //detach event handler...display the serial number of the detached RFID phidget
        void rfid_Detach(object sender, DetachEventArgs e)
        {
            IServiceProvider services       = Services;
            IMessageDisplay  messageDisplay = (IMessageDisplay)services.GetService(typeof(IMessageDisplay));

            messageDisplay.ShowFormattedMessage("RFID reader {0} detached!", e.Device.SerialNumber.ToString());
        }
Exemplo n.º 5
0
        /// <summary>
        /// Constructor
        /// </summary>
        public XmlView()
        {
            InitializeComponent();

            xml = new TextElement(richTextBox1);
            messageDisplay = new MessageDisplay("NUnit Project Editor");
        }
        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());
        }
Exemplo n.º 7
0
        private void InitializeViewElements()
        {
            dialogManager  = new DialogManager("NUnit Project Editor");
            messageDisplay = new MessageDisplay("NUnit Project Editor");

            browseProjectBaseCommand  = new ButtonElement(projectBaseBrowseButton);
            editConfigsCommand        = new ButtonElement(editConfigsButton);
            browseConfigBaseCommand   = new ButtonElement(configBaseBrowseButton);
            addAssemblyCommand        = new ButtonElement(addAssemblyButton);
            removeAssemblyCommand     = new ButtonElement(removeAssemblyButton);
            browseAssemblyPathCommand = new ButtonElement(assemblyPathBrowseButton);

            projectPath      = new TextElement(projectPathLabel);
            projectBase      = new TextElement(projectBaseTextBox);
            processModel     = new ComboBoxElement(processModelComboBox);
            domainUsage      = new ComboBoxElement(domainUsageComboBox);
            runtime          = new ComboBoxElement(runtimeComboBox);
            runtimeVersion   = new ComboBoxElement(runtimeVersionComboBox);
            activeConfigName = new TextElement(activeConfigLabel);

            configList = new ComboBoxElement(configComboBox);

            applicationBase   = new TextElement(applicationBaseTextBox);
            configurationFile = new TextElement(configFileTextBox);
            binPathType       = new RadioButtonGroup("BinPathType", autoBinPathRadioButton, manualBinPathRadioButton, noBinPathRadioButton);
            privateBinPath    = new TextElement(privateBinPathTextBox);
            assemblyPath      = new TextElement(assemblyPathTextBox);
            assemblyList      = new ListBoxElement(assemblyListBox);
        }
Exemplo n.º 8
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);
            }
        }
        private void InitializeViewElements()
        {
            dialogManager = new DialogManager("NUnit Project Editor");
            messageDisplay = new MessageDisplay("NUnit Project Editor");

            browseProjectBaseCommand = new ButtonElement(projectBaseBrowseButton);
            editConfigsCommand = new ButtonElement(editConfigsButton);
            browseConfigBaseCommand = new ButtonElement(configBaseBrowseButton);
            addAssemblyCommand = new ButtonElement(addAssemblyButton);
            removeAssemblyCommand = new ButtonElement(removeAssemblyButton);
            browseAssemblyPathCommand = new ButtonElement(assemblyPathBrowseButton);

            projectPath = new TextElement(projectPathLabel);
            projectBase = new TextElement(projectBaseTextBox);
            processModel = new ComboBoxElement(processModelComboBox);
            domainUsage = new ComboBoxElement(domainUsageComboBox);
            runtime = new ComboBoxElement(runtimeComboBox);
            runtimeVersion = new ComboBoxElement(runtimeVersionComboBox);
            activeConfigName = new TextElement(activeConfigLabel);

            configList = new ComboBoxElement(configComboBox);

            applicationBase = new TextElement(applicationBaseTextBox);
            configurationFile = new TextElement(configFileTextBox);
            binPathType = new RadioButtonGroup("BinPathType", autoBinPathRadioButton, manualBinPathRadioButton, noBinPathRadioButton);
            privateBinPath = new TextElement(privateBinPathTextBox);
            assemblyPath = new TextElement(assemblyPathTextBox);
            assemblyList = new ListBoxElement(assemblyListBox);
        }
Exemplo n.º 10
0
        //print the tag code for the tag that was just lost
        void rfid_TagLost(object sender, TagEventArgs e)
        {
            IServiceProvider services       = Services;
            IMessageDisplay  messageDisplay = (IMessageDisplay)services.GetService(typeof(IMessageDisplay));

            messageDisplay.ShowFormattedMessage("Tag {0} lost", e.Tag);
        }
Exemplo n.º 11
0
        //Error event handler...display the error description string
        void rfid_Error(object sender, ErrorEventArgs e)
        {
            IServiceProvider services       = Services;
            IMessageDisplay  messageDisplay = (IMessageDisplay)services.GetService(typeof(IMessageDisplay));

            messageDisplay.ShowFormattedMessage(e.Description);
        }
Exemplo n.º 12
0
 public MessagesService(IMessageDisplay messageDisplay)
 {
     Messages = new ObservableProperty <Message>(0);
     Messages
     .Do(messageDisplay.AddMessage)
     .Delay(m => Observable.Timer(m.TimeToLive))
     .Subscribe(messageDisplay.RemoveMessage);
 }
        public RenameConfigurationDialog()
        {
            InitializeComponent();

            configurationName = new TextElement(configurationNameTextBox);
            okButtonWrapper   = new ButtonElement(okButton);

            messageDisplay = new MessageDisplay("Rename Configuration");
        }
Exemplo n.º 14
0
        public LessonsOverviewViewModel(IUnityContainer container, IMessageDisplay messageDisplay)
        {
            this.PasteLessonCommand = new DelegateCommand(this.PasteLessonCommandExecute);

            this.BeginnerCourses = new ObservableCollection <LessonsOverviewEntryViewModel>();
            this.container       = container;
            this.messageDisplay  = messageDisplay;
            this.Initialize();
        }
        public RenameConfigurationDialog()
		{
			InitializeComponent();

            configurationName = new TextElement(configurationNameTextBox);
            okButtonWrapper = new ButtonElement(okButton);

            messageDisplay = new MessageDisplay("Rename Configuration");
        }
Exemplo n.º 16
0
        public LessonViewModel(IUnityContainer unityContainer, IMessageDisplay messageDisplay)
        {
            this.unityContainer = unityContainer;
            this.messageDisplay = messageDisplay;

            this.Paragraphs = new ObservableCollection <LessonParagraphViewModelBase>();

            this.CopyCommand  = new DelegateCommand(this.CopyCommandExecute);
            this.PasteCommand = new DelegateCommand(this.PasteCommandExecute);
        }
Exemplo n.º 17
0
        //attach event handler...display the serial number of the attached RFID phidget
        void rfid_Attach(object sender, AttachEventArgs e)
        {
            //Get the toast message component
            IServiceProvider services       = Services;
            IMessageDisplay  messageDisplay = (IMessageDisplay)services.GetService(typeof(IMessageDisplay));

            rfid.Antenna = true;
            rfid.LED     = true;

            //pop up a message
            messageDisplay.ShowFormattedMessage("RFIDReader {0} attached!", e.Device.SerialNumber.ToString());
        }
Exemplo n.º 18
0
        public MainForm()
        {
            InitializeComponent();

            this.messageDisplay = new MessageDisplay("Nunit Project Editor");
            this.dialogManager = new DialogManager("NUnit Project Editor");

            this.newProjectCommand = new MenuElement(newToolStripMenuItem);
            this.openProjectCommand = new MenuElement(openToolStripMenuItem);
            this.closeProjectCommand = new MenuElement(closeToolStripMenuItem);
            this.saveProjectCommand = new MenuElement(saveToolStripMenuItem);
            this.saveProjectAsCommand = new MenuElement(saveAsToolStripMenuItem);
        }
Exemplo n.º 19
0
        public MainForm()
        {
            InitializeComponent();

            this.messageDisplay = new MessageDisplay("Nunit Project Editor");
            this.dialogManager  = new DialogManager("NUnit Project Editor");

            this.newProjectCommand    = new MenuElement(newToolStripMenuItem);
            this.openProjectCommand   = new MenuElement(openToolStripMenuItem);
            this.closeProjectCommand  = new MenuElement(closeToolStripMenuItem);
            this.saveProjectCommand   = new MenuElement(saveToolStripMenuItem);
            this.saveProjectAsCommand = new MenuElement(saveAsToolStripMenuItem);
        }
        public ConfigurationEditorDialog()
        {
            InitializeComponent();

            addCommand    = new ButtonElement(addButton);
            removeCommand = new ButtonElement(removeButton);
            renameCommand = new ButtonElement(renameButton);
            activeCommand = new ButtonElement(activeButton);

            configList = new ListBoxElement(configListBox);

            messageDisplay = new MessageDisplay("NUnit Configuration Editor");
        }
        public ConfigurationEditorDialog()
		{
			InitializeComponent();

            addCommand = new ButtonElement(addButton);
            removeCommand = new ButtonElement(removeButton);
            renameCommand = new ButtonElement(renameButton);
            activeCommand = new ButtonElement(activeButton);

            configList = new ListBoxElement(configListBox);

            messageDisplay = new MessageDisplay("NUnit Configuration Editor");
		}
Exemplo n.º 22
0
        /// <summary>
        /// Initializes the component.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            // Look up the IMessageDisplay service, which will
            // be used to report gamer join/leave notifications.
            messageDisplay = (IMessageDisplay)Game.Services.GetService(
                typeof(IMessageDisplay));

            if (messageDisplay != null)
            {
                notifyWhenPlayersJoinOrLeave = true;
            }
        }
        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);
        }
        /// <summary>
        /// Initializes the component.
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();

            // Look up the IMessageDisplay service, which will
            // be used to report gamer join/leave notifications.
            messageDisplay = (IMessageDisplay)Game.Services.GetService(
                                                              typeof(IMessageDisplay));

            if (messageDisplay != null)
                notifyWhenPlayersJoinOrLeave = true;
        }
 private void RegisterActivityMessagePanel(IMessageDisplay messagePanel)
 {
     this.MessagePanel = messagePanel;
 }
 private void RegisterActivityMessagePanel(IMessageDisplay messagePanel)
 {
     this.MessagePanel = messagePanel;
 }