コード例 #1
0
        public void Setup()
        {
            //start service
            var config = new NRobotServerConfig();

            config.Port = 8270;
            config.AssemblyConfigs.Add("NRobot.Server.Test.Keywords.TestKeywords",
                                       new LibraryConfig()
            {
                Assembly      = "NRobot.Server.Test",
                TypeName      = "NRobot.Server.Test.Keywords.TestKeywords",
                Documentation = "NRobot.Server.Test.XML"
            });
            config.AssemblyConfigs.Add("NRobot.Server.Test.Keywords.WithDocumentationClass",
                                       new LibraryConfig()
            {
                Assembly      = "NRobot.Server.Test",
                TypeName      = "NRobot.Server.Test.Keywords.WithDocumentationClass",
                Documentation = "NRobot.Server.Test.XML"
            });
            config.AssemblyConfigs.Add("NRobot.Server.Test.Keywords.RunKeyword",
                                       new LibraryConfig()
            {
                Assembly      = "NRobot.Server.Test",
                TypeName      = "NRobot.Server.Test.Keywords.RunKeyword",
                Documentation = "NRobot.Server.Test.XML"
            });
            _service = new NRobotService(config);
            _service.StartAsync();
        }
コード例 #2
0
        public void StartService_NoDocumentation()
        {
            var config = new NRobotServerConfig();

            config.Port = 8270;
            config.AssemblyConfigs.Add("NRobot.Server.Test.Keywords.TestKeywords",
                                       new LibraryConfig()
            {
                Assembly = "NRobot.Server.Test",
                TypeName = "NRobot.Server.Test.Keywords.TestKeywords"
            });
            _service = new NRobotService(config);
            _service.StartAsync();
        }
コード例 #3
0
        //constructor
        public TrayApplication()
        {
            //setup controls
            _contextmenu    = new ContextMenuStrip();
            _exitoption     = new ToolStripMenuItem("Exit");
            _aboutoption    = new ToolStripMenuItem("About");
            _keywordsoption = new ToolStripMenuItem("Keywords");
            _trayicon       = new NotifyIcon();
            //setup tray icon and tooltip
            System.IO.Stream           st;
            System.Reflection.Assembly a = Assembly.GetExecutingAssembly();
            st             = a.GetManifestResourceStream("LogoIcon");
            _trayicon.Icon = new System.Drawing.Icon(st);
            _trayicon.Text = String.Format("NRobot.Server version {0}", Assembly.GetExecutingAssembly().GetName().Version);
            //setup context menu
            _contextmenu.Items.Add(_keywordsoption);
            _contextmenu.Items.Add(_aboutoption);
            _contextmenu.Items.Add(_exitoption);
            //setup events
            _exitoption.Click     += ExitOptionClick;
            _aboutoption.Click    += AboutOptionClick;
            _keywordsoption.Click += KeywordsOptionClick;
            //display
            _trayicon.ContextMenuStrip = _contextmenu;
            _trayicon.Visible          = true;

            //setup nrobot server
            try
            {
                //start service
                _serviceConfig = NRobotServerConfig.LoadXmlConfiguration();
                _service       = new NRobotService(_serviceConfig);
                _service.StartAsync();
                IsRunning = true;
            }
            catch (Exception e)
            {
                Log.Fatal(e.Message, e);
                MessageBox.Show(String.Format("Unable to start NRobot.Server: \n\n{0}", e.ToString()), "Error", MessageBoxButtons.OK);
                IsRunning = false;
            }
        }