public void EmptyServerDescriptorTest()
        {
            TestGraphicalUserInterface _ui  = new TestGraphicalUserInterface();
            ServerSelector             _nss = new ServerSelector(_ui, string.Empty, string.Empty, string.Empty);

            Assert.IsFalse(_ui.WarningCalled);
        }
        void theControl_Checked(object sender, RoutedEventArgs e)
        {
            ServerInfo theServerInfo = null;

            brdServerInfo.Visibility = Visibility.Visible;
            ServerSelector theServer = sender as ServerSelector;

            if (theServer == null)
            {
                RadioButton rbIWasSelected = sender as RadioButton;
                theServerInfo = rbIWasSelected.DataContext as ServerInfo;
            }
            else
            {
                theServerInfo = theServer.TheServerInfo;
            }

            grdPatcher.Children.Clear();
            PatchProgress myPatchProgress = new PatchProgress(theServerInfo, myUserPrefs);

            myPatchProgress.DataContext    = this.DataContext;
            myPatchProgress.Loaded        += new RoutedEventHandler(myPatchProgress_Loaded);
            myPatchProgress.OnError       += new EventHandler <ErrorMessageEventArgs>(myPatchProgress_OnError);
            myPatchProgress.PatchComplete += new EventHandler <Patcher.PatchFunctionCompleteEventArgs>(myPatchProgress_PatchComplete);
            grdPatcher.Children.Add(myPatchProgress);
            rctOverlay.Visibility = Visibility.Visible;
        }
Esempio n. 3
0
        public void GetPluginRelativePathNamesXTest()
        {
            Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>();

            _directory.SetupGet(x => x.DefaultDirectory).Returns(Directory.GetCurrentDirectory());
            Mock <IGraphicalUserInterface> _gui = new Mock <IGraphicalUserInterface>();
            Mock <IFileDialog>             _openFileDialogMock   = new Mock <IFileDialog>();
            Mock <IFolderBrowserDialog>    _IFolderBrowserDialog = new Mock <IFolderBrowserDialog>();
            string _message = String.Empty;
            string _caption = String.Empty;

            _gui.Setup(x => x.MessageBoxShowWarning);
            _gui.Setup(x => x.MessageBoxShowError);
            _gui.SetupGet(x => x.MessageBoxShowExclamation).Returns(() => (message, caption) => { _message = message; _caption = caption; });
            _gui.SetupGet(x => x.OpenFileDialogFunc).Returns(() => () => _openFileDialogMock.Object);
            _gui.SetupGet(x => x.OpenFolderBrowserDialogFunc).Returns(() => () => _IFolderBrowserDialog.Object);
            ServerSelector _underTestItem = new ServerSelector(_gui.Object, _directory.Object, m_PluginFullPath, "");

            ServerSelector.ServerDescriptor _pluginPaths = _underTestItem.ServerConfiguration;
            //test behavior
            _gui.Verify(x => x.MessageBoxShowError, Times.Never);
            _gui.Verify(x => x.MessageBoxShowWarning, Times.Never);
            _gui.Verify(x => x.MessageBoxShowExclamation, Times.Exactly(2));
            _gui.Verify(x => x.OpenFileDialogFunc, Times.Once);
            _gui.Verify(x => x.OpenFolderBrowserDialogFunc, Times.Once);
            //test result
            Assert.IsNotNull(_pluginPaths);
            Assert.AreEqual <string>(m_ConfigurationDefaultFileName, _pluginPaths.Configuration);
            Assert.AreEqual <string>(m_PluginFullPath, _pluginPaths.Codebase);
        }
        public void ServerConfigurationNullTest()
        {
            TestGraphicalUserInterface _tg  = new TestGraphicalUserInterface();
            ServerSelector             _nss = new ServerSelector(_tg, "", "", "");

            Assert.IsFalse(_tg.WarningCalled);
        }
        public void ServerConfigurationWrongAssemblyTest()
        {
            TestGraphicalUserInterface _tgi = new TestGraphicalUserInterface();
            ServerSelector             _nss = new ServerSelector(_tgi, "wrong_path", "wrong.codebase", "wrong.configuration");

            Assert.IsTrue(_tgi.WarningCalled);
            Assert.IsTrue(_tgi.WarningMessage.Contains("wrong.codebase"));
            Assert.AreEqual <string>("Open configuration editor", _tgi.WarningCaption);
        }
        public void ServerSelectorCreatorTest()
        {
            TestGraphicalUserInterface _tg  = new TestGraphicalUserInterface();
            ServerSelector             _nss = new ServerSelector(_tg, "", "", "");

            Assert.IsNull(_nss.SelectedAssembly);
            Assert.IsNull(_nss.ServerConfiguration);
            Assert.IsNull(_nss.IServerConfiguration);
        }
Esempio n. 7
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Administrator_Authentication();
     Connection_Authentication();
     countryLocation = new ServerSelector();
     MainUI          = new DashboardDesignClass();
     CountriesCmBox.SelectedIndex = 0;
     MainUI.DisconnectBtn_Enabled_False();
 }
        public void EmptyServerDescriptorTest()
        {
            Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>();

            _directory.SetupGet(x => x.BaseDirectory).Returns(string.Empty);
            TestGraphicalUserInterface _ui  = new TestGraphicalUserInterface();
            ServerSelector             _nss = new ServerSelector(_ui, _directory.Object, string.Empty, string.Empty);

            Assert.IsFalse(_ui.WarningCalled);
        }
        public void ServerConfigurationNullTest()
        {
            Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>();

            _directory.SetupGet(x => x.BaseDirectory).Returns(@"C:\");
            TestGraphicalUserInterface _tg  = new TestGraphicalUserInterface();
            ServerSelector             _nss = new ServerSelector(_tg, _directory.Object, "", "");

            Assert.IsFalse(_tg.WarningCalled);
        }
Esempio n. 10
0
 /// <summary>
 ///     Constructs a <see cref="V2Client"/>.
 ///     <para>
 ///         This constructor takes in a lot of dependencies; generally,
 ///         code using <see cref="V2Client"/> will just ask for one from
 ///         a dependency injector rather than manually constructing
 ///         one.
 ///     </para>
 /// </summary>
 /// <param name="connectionManager">
 ///     A <see cref="MessageConnectionManager"/>, used to build and hold onto
 ///     message-passing connections to a BAPS server.
 /// </param>
 /// <param name="configCache">
 ///     A server configuration cache, used to hold onto config
 ///     information received from the BAPS server.
 /// </param>
 /// <param name="init">
 ///     An initial update performer, used to send certain set-up
 ///     messages to a BAPS server on connecting to one.
 /// </param>
 /// <param name="serverSelector">
 ///     An object that performs server selection.
 /// </param>
 /// <param name="login">
 ///     An object that performs authentication for low-level connections to the BAPS server, returning
 ///     <see cref="TcpPrimitiveConnection"/>s that are then sent to the
 ///     <paramref name="connectionManager"/>.
 /// </param>
 public V2Client(MessageConnectionManager connectionManager, ConfigCache configCache, InitialUpdatePerformer init,
                 ServerSelector serverSelector,
                 ClientSideLoginPerformer <SeededPrimitiveConnection, IMessageConnection> login)
 {
     _connectionManager = connectionManager;
     _configCache       = configCache;
     _init           = init;
     _serverSelector = serverSelector;
     _login          = login;
 }
Esempio n. 11
0
        public void ServerSelectorCreatorTest()
        {
            Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>();

            _directory.SetupGet(x => x.BaseDirectory).Returns(@"C:\");
            TestGraphicalUserInterface _tg  = new TestGraphicalUserInterface();
            ServerSelector             _nss = new ServerSelector(_tg, _directory.Object, "", "");

            Assert.IsNull(_nss.SelectedAssembly);
            Assert.IsNull(_nss.ServerConfiguration);
            Assert.IsNull(_nss.IServerConfiguration);
        }
 private void AddServer(ServerInfo theServerInfo)
 {
     this.Dispatcher.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate()
     {
         svspServers.Visibility    = Visibility.Collapsed;
         svwpServers.Visibility    = Visibility.Visible;
         ServerSelector theControl = new ServerSelector(theServerInfo, myUserPrefs, false, myVariables);
         theControl.Checked       += new RoutedEventHandler(theControl_Checked);
         theControl.Margin         = thck;
         wpServers.Children.Add(theControl);
     }), System.Windows.Threading.DispatcherPriority.Normal);
 }
Esempio n. 13
0
        public void ServerConfigurationWrongAssemblyTest()
        {
            Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>();

            _directory.SetupGet(x => x.BaseDirectory).Returns(@"wrong_path");
            TestGraphicalUserInterface _tgi = new TestGraphicalUserInterface();
            ServerSelector             _nss = new ServerSelector(_tgi, _directory.Object, "wrong.codebase", "wrong.configuration");

            Assert.IsTrue(_tgi.WarningCalled);
            Assert.IsTrue(_tgi.WarningMessage.Contains("wrong.codebase"));
            Assert.AreEqual <string>("Open configuration editor", _tgi.WarningCaption);
        }
 private void AddServer(ServerInfo theServerInfo)
 {
     this.Dispatcher.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate()
     {
         svspServers.Visibility = Visibility.Collapsed;
         svwpServers.Visibility = Visibility.Visible;
         ServerSelector theControl = new ServerSelector(theServerInfo, myUserPrefs, false, myVariables);
         theControl.Checked += new RoutedEventHandler(theControl_Checked);
         theControl.Margin = thck;
         wpServers.Children.Add(theControl);
     }), System.Windows.Threading.DispatcherPriority.Normal);
 }
Esempio n. 15
0
        public void ConstructorTest()
        {
            Mock <IGraphicalUserInterface>          _IGraphicalUserInterface = new Mock <IGraphicalUserInterface>();
            Mock <ISolutionConfigurationManagement> _solutionManagement      = new Mock <ISolutionConfigurationManagement>();

            _solutionManagement.SetupGet <string>(x => x.Name).Returns("Name");
            ServerSelector _serverSelector = new ServerSelector(_IGraphicalUserInterface.Object, _solutionManagement.Object, "", "");

            _solutionManagement.SetupGet <ServerSelector>(x => x.ServerSelector).Returns(_serverSelector);
            Mock <IMessageBoxHandling> _IMessageBoxHandlingMock = new Mock <IMessageBoxHandling>();
            int _librariesCallCounter = 0;

            Assert.ThrowsException <ArgumentNullException>(() => new SolutionTreeNode(null, _solutionManagement.Object, (x, y) => { Assert.Fail(); }, z => _librariesCallCounter++));
            Assert.ThrowsException <ArgumentNullException>(() => new SolutionTreeNode(_IMessageBoxHandlingMock.Object, null, (x, y) => { Assert.Fail(); }, z => _librariesCallCounter++));
            SolutionTreeNode _instanceUnderTest = new SolutionTreeNode(_IMessageBoxHandlingMock.Object, _solutionManagement.Object, (x, y) => { Assert.Fail(); }, z => _librariesCallCounter++);
            //_IMessageBoxHandlingMock
            IMessageBoxHandling _assignedIMessageBoxHandling = null;

            _instanceUnderTest.GetMessageBoxHandling(x => _assignedIMessageBoxHandling = x);
            Assert.IsNotNull(_assignedIMessageBoxHandling);
            Assert.AreSame(_IMessageBoxHandlingMock.Object, _assignedIMessageBoxHandling);
            Assert.AreEqual <int>(0, _IMessageBoxHandlingMock.Invocations.Count);
            //State
            Assert.ThrowsException <NullReferenceException>(() => _instanceUnderTest.AvailiableNamespaces);
            Assert.AreEqual <int>(0, _instanceUnderTest.Count);
            Assert.IsNotNull(_instanceUnderTest.ErrorList);
            Assert.AreEqual <int>(0, _instanceUnderTest.ErrorList.Count);
            Assert.AreEqual <string>("", _instanceUnderTest.HelpTopicName);
            Assert.AreSame(_solutionManagement.Object, _instanceUnderTest.HomeDirectory);
            Assert.IsFalse(_instanceUnderTest.IsReadOnly);
            Assert.AreEqual <string>(_solutionManagement.Object.Name, _instanceUnderTest.Name);
            Assert.AreEqual <NodeClassesEnum>(NodeClassesEnum.None, _instanceUnderTest.NodeClass);
            Assert.AreEqual <NodeTypeEnum>(NodeTypeEnum.SolutionNode, _instanceUnderTest.NodeType);
            Assert.IsNull(_instanceUnderTest.Parent);
            Assert.IsNotNull(_instanceUnderTest.Server);
            Assert.AreSame(_serverSelector, _instanceUnderTest.Server);
            Assert.IsNotNull(_instanceUnderTest.SymbolicName);
            Assert.AreEqual <string>(_solutionManagement.Object.Name, _instanceUnderTest.Text);
            Assert.IsNull(_instanceUnderTest.ToolTipText);
            Assert.IsNotNull(_instanceUnderTest.Wrapper);
            Assert.IsInstanceOfType(_instanceUnderTest.Wrapper, typeof(Wrappers4ProperyGrid.UAModelDesignerSolutionWrapper));
            Assert.IsNotNull(_instanceUnderTest.Wrapper4PropertyGrid);
            Assert.IsInstanceOfType(_instanceUnderTest.Wrapper4PropertyGrid, typeof(Wrappers4ProperyGrid.UAModelDesignerSolutionWrapper));
            Libraries _libraries = null;

            _instanceUnderTest.GetLibraries(x => _libraries = x);
            Assert.IsNotNull(_libraries);
            Assert.AreEqual <int>(1, _libraries.Count);
            Assert.AreEqual <int>(1, _librariesCallCounter);
        }
Esempio n. 16
0
        public void ServerConfigurationWTest()
        {
            TestGraphicalUserInterface _ui  = new TestGraphicalUserInterface();
            ServerSelector             _nss = new ServerSelector(_ui, "wrong_path", "CAS.CommServer.UA.ConfigurationEditor.ServerConfiguration.dll", "");

            Assert.AreEqual <int>(2, _ui.ExclamationCallCount);
            Assert.AreEqual <int>(0, _ui.ErrorCallCount);
            Assert.AreEqual <int>(0, _ui.OpenFileDialog4UnitTestAssertErrors);
            CollectionAssert.AreEqual(new string[] { }, _ui.ErrorCaption);
            CollectionAssert.AreEqual(new string[] { }, _ui.ErrorMessage);
            CollectionAssert.AreEqual(new string[] { "No configuration file has been selected!", "No folder is selected" }, _ui.ExclamationCaption);
            CollectionAssert.AreEqual(new string[] { "You did not choose the configuration file. Please select a location of the default configuration file.",
                                                     "Folder is not selected, configuration will be created in the default location." }, _ui.ExclamationMessage);
        }
Esempio n. 17
0
        public void ConstructorWrongAssemblyTest()
        {
            Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>();

            _directory.SetupGet(x => x.DefaultDirectory).Returns(Directory.GetCurrentDirectory());
            TestGraphicalUserInterface _tgi = new TestGraphicalUserInterface();
            ServerSelector             _nss = new ServerSelector(_tgi, _directory.Object, "wrong.codebase", "wrong.configuration");

            //_nss
            Assert.IsNull(_nss.IServerConfiguration);
            Assert.IsNull(_nss.SelectedAssembly);
            Assert.IsNull(_nss.ServerConfiguration);
            //_tgi
            Assert.IsTrue(_tgi.WarningCalled);
            Assert.IsTrue(_tgi.WarningMessage.Contains("wrong.codebase"));
            Assert.AreEqual <string>("Open configuration editor", _tgi.WarningCaption);
        }
Esempio n. 18
0
 public void ExitMethod()
 {
     if (ConnectBtn.Enabled == false)
     {
         MessageBox.Show("Please Disconnect First", "Error at 0x168", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
     else
     {
         VPN.Dispose();
         VPN             = null;
         MainUI          = null;
         countryLocation = null;
         InfoDialog      = null;
         GC.Collect();
         Application.Exit();
     }
 }
 private void AddServer(ServerInfo theServerInfo)
 {
     this.Dispatcher.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate()
     {
         svspServers.Visibility = Visibility.Collapsed;
         svwpServers.Visibility = Visibility.Visible;
         ServerSelector theControl = new ServerSelector(theServerInfo, myUserPrefs, true, myTextVariables);
         theControl.Checked += new RoutedEventHandler(theControl_Checked);
         theControl.MouseDoubleClick += new MouseButtonEventHandler(theControl_MouseDoubleClick);
         theControl.Margin = thck;
         wpServers.Children.Add(theControl);
         if (myUserPrefs.DefaultServer == theServerInfo.ServerId)
         {
             theControl.IsChecked = true;
             theControl.BringIntoView();
         }
     }), System.Windows.Threading.DispatcherPriority.Normal);
 }
Esempio n. 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SolutionTreeNode" /> class.
 /// </summary>
 /// <param name="messageBoxHandling">The Message Box instance to provide messages on the screen.</param>
 /// <param name="solution">The configuration.</param>
 /// <param name="solutionPath">The solution path.</param>
 /// <param name="OnChangeHandler">The on change handler.</param>
 /// <param name="creteLibraryTreeNode">The call back to create <see cref="LibraryTreeNode"/>.</param>
 /// <exception cref="ArgumentNullException">configuration
 /// or
 /// messageBoxHandling</exception>
 internal SolutionTreeNode(IMessageBoxHandling messageBoxHandling, UAModelDesignerSolution solution, string solutionPath, EventHandler <EventArgs> OnChangeHandler, Action <LibraryTreeNode> creteLibraryTreeNode) :
     base(null, solution == null ? Guid.NewGuid().ToString() : solution.Name)
 {
     MessageBoxHandling = messageBoxHandling ?? throw new ArgumentNullException(nameof(messageBoxHandling));
     HomeDirectory      = solutionPath;
     if (solution.ServerDetails == null)
     {
         solution.ServerDetails = UAModelDesignerSolutionServerDetails.CreateEmptyInstance();
     }
     Server = new ServerSelector(new GraphicalUserInterface(), solutionPath, solution.ServerDetails.codebase, solution.ServerDetails.configuration);
     Server.OnConfigurationChanged += new EventHandler <UAServerConfigurationEventArgs>(Server_OnConfigurationChanged);
     //TODO OnDataChanged += OnChangeHandler;
     //TODO OnNameChanged += new EventHandler(configuration_OnNameChanged);
     AddProjectsNodes(solution.Projects);
     BaseDirectoryHelper.Instance.SetBaseDirectoryProvider(this);
     SolutionRoot = this;
     LibraryRoot.AddNodes(creteLibraryTreeNode);
 }
Esempio n. 21
0
 private void AddServer(ServerInfo theServerInfo)
 {
     this.Dispatcher.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate()
     {
         svspServers.Visibility       = Visibility.Collapsed;
         svwpServers.Visibility       = Visibility.Visible;
         ServerSelector theControl    = new ServerSelector(theServerInfo, myUserPrefs, true, myTextVariables);
         theControl.Checked          += new RoutedEventHandler(theControl_Checked);
         theControl.MouseDoubleClick += new MouseButtonEventHandler(theControl_MouseDoubleClick);
         theControl.Margin            = thck;
         wpServers.Children.Add(theControl);
         if (myUserPrefs.DefaultServer == theServerInfo.ServerId)
         {
             theControl.IsChecked = true;
             theControl.BringIntoView();
         }
     }), System.Windows.Threading.DispatcherPriority.Normal);
 }
        internal SolutionConfigurationManagement(Tuple <UAModelDesignerSolution, string> solutionDescription, bool changesArePresent, IGraphicalUserInterface gui) : base(solutionDescription.Item2, changesArePresent, gui)
        {
            AssemblyTraceEvent.Tracer.TraceEvent(TraceEventType.Verbose, 335242041, "Creating new private solution using Empty model");
            m_Name = solutionDescription.Item1.Name;
            UAModelDesignerSolutionServerDetails _ServerDetails = solutionDescription.Item1.ServerDetails ?? throw new ArgumentNullException(nameof(UAModelDesignerSolution.ServerDetails));

            m_Projects = solutionDescription.Item1.Projects.Select <UAModelDesignerProject, IProjectConfigurationManagement>(x => ProjectConfigurationManagement.ImportModelDesign(this, base.GraphicalUserInterface, x)).ToList <IProjectConfigurationManagement>();
            string _codebase      = RelativeFilePathsCalculator.CalculateAbsoluteFileName(this.DefaultDirectory, _ServerDetails.codebase);
            string _configuration = RelativeFilePathsCalculator.CalculateAbsoluteFileName(this.DefaultDirectory, _ServerDetails.configuration);

            m_Server = new ServerSelector(base.GraphicalUserInterface, this, _codebase, _configuration);
            if (string.IsNullOrEmpty(Settings.Default.DefaultSolutionFileName))
            {
                Settings.Default.DefaultSolutionFileName = DefaultFileName;
                Settings.Default.Save();
            }
            AssemblyTraceEvent.Tracer.TraceEvent(TraceEventType.Verbose, 335242042, "Finished successfully CommonInitialization");
        }
Esempio n. 23
0
        void theControl_Checked(object sender, RoutedEventArgs e)
        {
            ServerInfo theServerInfo = null;

            brdServerInfo.Visibility = Visibility.Visible;
            ServerSelector theServer = sender as ServerSelector;

            if (theServer == null)
            {
                RadioButton rbIWasSelected = sender as RadioButton;
                theServerInfo = rbIWasSelected.DataContext as ServerInfo;
            }
            else
            {
                theServerInfo = theServer.TheServerInfo;
            }

            //populate the labels
            lblServerName.Text = theServerInfo.ServerName;

            if (theServerInfo.ServerId == myUserPrefs.DefaultServer)
            {
                lblServerName.Text += " (" + myTextVariables.DefaultServer + ")";;
            }
            lblServerDescription.Text = theServerInfo.Description;
            lblServerBuild.Text       = "1.0";
            lblServerPopulation.Text  = theServerInfo.Population.ToString();

            currentServer = theServerInfo;

            if (myUserPrefs.UserCustomServers.Any(ucs => ucs.ServerId == theServerInfo.ServerId))
            {
                Storyboard sbShowCustomButtons = (Storyboard)this.Resources["ShowCustomServerButtons"];
                sbShowCustomButtons.Begin();
            }
            else
            {
                Storyboard sbHideButtons = (Storyboard)this.Resources["HideCustomServerButtons"];
                sbHideButtons.Begin();
            }
        }
Esempio n. 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SolutionTreeNode" /> class.
 /// </summary>
 /// <param name="messageBoxHandling">The Message Box instance to provide messages on the screen.</param>
 /// <param name="solution">The configuration.</param>
 /// <param name="solutionPath">The solution path.</param>
 /// <param name="OnChangeHandler">The on change handler.</param>
 /// <param name="creteLibraryTreeNode">The call back to create <see cref="LibraryTreeNode"/>.</param>
 /// <exception cref="ArgumentNullException">configuration
 /// or
 /// messageBoxHandling</exception>
 internal SolutionTreeNode(IMessageBoxHandling messageBoxHandling, UAModelDesignerSolution solution, string solutionPath, EventHandler <EventArgs> OnChangeHandler, Action <LibraryTreeNode> creteLibraryTreeNode) :
     base(null, solution == null ? Guid.NewGuid().ToString() : solution.Name)
 {
     MessageBoxHandling = messageBoxHandling ?? throw new ArgumentNullException(nameof(messageBoxHandling));
     m_PathManagement.SetNewPath(solutionPath);
     if (solution == null)
     {
         throw new ArgumentNullException(nameof(solution), $"In constructor {nameof(SolutionTreeNode)} this argument must not be null.");
     }
     if (solution.ServerDetails == null)
     {
         solution.ServerDetails = UAModelDesignerSolutionServerDetails.CreateEmptyInstance();
     }
     Server = new ServerSelector(new GraphicalUserInterface(), m_PathManagement, solution.ServerDetails.codebase, solution.ServerDetails.configuration);
     Server.OnConfigurationChanged += new EventHandler <UAServerConfigurationEventArgs>(Server_OnConfigurationChanged);
     //TODO OnDataChanged += OnChangeHandler;
     //TODO OnNameChanged += new EventHandler(configuration_OnNameChanged);
     AddProjectsNodes(solution.Projects);
     SolutionRoot = this;
     LibraryRoot.AddNodes(creteLibraryTreeNode);
 }
Esempio n. 25
0
        public void PluginOkWrongConfigurationTest()
        {
            Mock <ISolutionDirectoryPathManagement> _directory = new Mock <ISolutionDirectoryPathManagement>();

            _directory.SetupGet(x => x.DefaultDirectory).Returns(Directory.GetCurrentDirectory());
            TestGraphicalUserInterface _tgi           = new TestGraphicalUserInterface();
            ServerSelector             _underTestItem = new ServerSelector(_tgi, _directory.Object, m_PluginFullPath, "");
            //_underTestItem
            int  _configurationChanged = 0;
            bool _configuration        = false;;

            _underTestItem.OnConfigurationChanged += (x, y) => { _configurationChanged++; _configuration = y.ConfigurationFileChanged; };
            Assert.IsNotNull(_underTestItem.IServerConfiguration);
            Assert.IsFalse(String.IsNullOrEmpty(_underTestItem.IServerConfiguration.DefaultFileName));
            Assert.AreEqual <string>("CAS.UAServer.Configuration.uasconfig", _underTestItem.IServerConfiguration.DefaultFileName);
            Assert.IsNotNull(_underTestItem.SelectedAssembly);
            Assert.IsNotNull(_underTestItem.SelectedAssembly.Configuration);
            Assert.IsNotNull(_underTestItem.ServerConfiguration);
            Assert.AreEqual <string>(m_PluginFullPath, _underTestItem.ServerConfiguration.Codebase);
            Assert.AreEqual <string>(Path.Combine(Directory.GetCurrentDirectory(), _underTestItem.IServerConfiguration.DefaultFileName), _underTestItem.ServerConfiguration.Configuration);
            Assert.AreEqual <int>(0, _configurationChanged);
            Assert.IsFalse(_configuration);
            _underTestItem.IServerConfiguration.CreateDefaultConfiguration();
            Assert.AreEqual <int>(2, _configurationChanged);
            Assert.IsTrue(_configuration);
            _underTestItem.IServerConfiguration.CreateDefaultConfiguration();
            Assert.AreEqual <int>(4, _configurationChanged);
            Assert.IsTrue(_configuration);

            //_tgi
            Assert.AreEqual <int>(2, _tgi.ExclamationCallCount);
            Assert.AreEqual <int>(0, _tgi.ErrorCallCount);
            Assert.AreEqual <int>(0, _tgi.OpenFileDialog4UnitTestAssertErrors);
            CollectionAssert.AreEqual(new string[] { }, _tgi.ErrorCaption);
            CollectionAssert.AreEqual(new string[] { }, _tgi.ErrorMessage);
            CollectionAssert.AreEqual(new string[] { "No configuration file has been selected!", "No folder is selected" }, _tgi.ExclamationCaption);
            CollectionAssert.AreEqual(new string[] { "You did not choose the configuration file. Please select a location of the default configuration file.",
                                                     "Folder is not selected, configuration will be created in the default location." }, _tgi.ExclamationMessage);
        }
Esempio n. 26
0
        void theControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ServerInfo     theServerInfo = null;
            ServerSelector theServer     = sender as ServerSelector;

            if (theServer == null)
            {
                RadioButton rbIWasSelected = sender as RadioButton;
                theServerInfo = rbIWasSelected.DataContext as ServerInfo;
            }
            else
            {
                theServerInfo = theServer.TheServerInfo;
            }

            myUserPrefs.UpdateSettings(UserPreferences.SettingsType.DefaultServer, theServerInfo.ServerId);

            //lblServerName.Text = theServerInfo.ServerName + " (" + myTextVariables.DefaultServer + ")";

            if (DefaultServerSelected != null)
            {
                DefaultServerSelected(this, e);
            }
        }
Esempio n. 27
0
	// Update is called once per frame
	void Update () {
		if (CrossPlatformInputManager.GetButtonDown("Zoom")){
            ToggleZoom();
		}
		if (Input.GetKeyUp(KeyCode.Escape)){
			TransitionToMeatspace();
		}
        if (Input.GetKeyUp(KeyCode.Q))
        {
            TransitionToSubroutineWorkspace();
        }

		if (isZoomedOut){
			if (CrossPlatformInputManager.GetButtonDown("Fire1")){
				if (currentServer != null && currentServer.CanBeSelected)
					OnServerSelect();
				//else if (hoverSubnet != null)
				//	OnSubnetSelect();
			} else if (!isWarping){
				RaycastHit hit;
				Ray pointRay = zoomCamera.ScreenPointToRay(Input.mousePosition);

				if (Physics.Raycast(pointRay, out hit, Mathf.Infinity)){

					if (hit.collider != null){
						ServerSelector s = hit.collider.GetComponent<ServerSelector>();
						
						if (s != null){
							if (currentServer != null)
							{
								currentServer.OnHoverOff();
							}
							currentServer = s;
							s.OnHoverOver();
						}
					}
				} else {
					if (currentServer != null){
						currentServer.OnHoverOff();
						currentServer = null;
					}
				}
			}
		}
	}
Esempio n. 28
0
        private new void Show()
        {
            var show = new ServerSelector();

            show.Show();
        }
Esempio n. 29
0
        static void Main(string[] args)
        {
            ServerSelector serverselector = new ServerSelector();

            serverselector.select();
        }