Ejemplo n.º 1
0
        private void AddNew()
        {
            var    conn    = new Connection();
            string message = Language.Resource.Message;
            bool   check   = conn.CheckExists(tbxName.Text);

            if (check)
            {
                MessageBox.Show(Language.Resource.NameExists, message);
            }
            else
            {
                conn.Name     = tbxName.Text;
                conn.Server   = tbxServer.Text;
                conn.Database = tbxDatabase.Text;
                conn.Username = tbxUser.Text;
                conn.Password = tbxPassword.Text;
                conn.Provider = tbxProvider.Text;

                int result = conn.Add();
                if (result == 1)
                {
                    var manager = (frmManager)Application.OpenForms["frmManager"];
                    manager.SelectTab("tabConnections");
                    Close();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Присоединит переданный объект, используя переданный Location.
        /// </summary>
        public void Attach(IPhysical body, Frame3D realLocation, bool joinWithFriction = true)
        {
            var bb = (BepuBody)body;
            var rb = bb.RealBody;

            BepuConverter.PutInFrame(rb, realLocation, bb.InitialOrientation);
            //bb.RealBody.Position = new Vector3(-bb.RealBody.Position.X, bb.RealBody.Position.Y, bb.RealBody.Position.Z);
            rb.Position    += RealBody.Position;
            rb.Orientation *= RealBody.Orientation;
            SolverGroup wj = BepuWorld.MakeWeldJoint(RealBody, rb);
            Connection  c;

            try            //есть connection
            {
                c = _connections.First(x => x.OtherBody == rb);
                c.Add(wj);
            }
            catch (Exception)            //нет connection
            {
                c = new Connection(rb);
                c.Add(wj);
                _connections.Add(c);                //connection добавляем для обоих тел! М.К.
                bb._connections.Add(c);
            }
        }
        public void AddTest()
        {
            ConnectionTest();
            if (instance != null)
            {
                if (instance.IsOpen)
                {
                    bool success = Utilities.IsSuccess(() => instance.Add("Hello", "World"));

                    Assert.IsTrue(success);
                }
            }
            else
            {
                Assert.Fail("Invalid connection instance.");
            }
        }
Ejemplo n.º 4
0
        //accessing the objects and using the objects

        public static void GetVal(Objects objs)
        {
            Connection objdal = new Connection();

            if (objs.id == null)
            {
                objdal.Add(objs);
            }
            else
            {
                objdal.updateData(objs);
            }
        }
        public async Task TestConnection()
        {
            _password = GetText();
            var result = await _ftpService.Value.CheckConnectionAsync(UserName, _password, Server);

            if (result == FtpService.FtpConnectionResult.Valid)
            {
                TestResult = "Valid forbindelse";
                Connection.Clear();
            }
            else
            {
                TestResult = "Kunne ikke forbinde";
                Connection.Add("Server", "Kunne ikke forbinde");
                Connection.Add("UserName", "Kunne ikke forbinde");
            }

            OnPropertyChanged("Server");
            OnPropertyChanged("UserName");
        }
Ejemplo n.º 6
0
		/// <summary>
		/// Присоединит переданный объект, используя переданный Location.
		/// </summary>		
		public void Attach(IPhysical body, Frame3D realLocation, bool joinWithFriction = true)
		{
			var bb = (BepuBody) body;
			var rb = bb.RealBody;
			BepuConverter.PutInFrame(rb, realLocation, bb.InitialOrientation);
			//bb.RealBody.Position = new Vector3(-bb.RealBody.Position.X, bb.RealBody.Position.Y, bb.RealBody.Position.Z);
			rb.Position += RealBody.Position;
			rb.Orientation *= RealBody.Orientation;
			SolverGroup wj = BepuWorld.MakeWeldJoint(RealBody, rb);
			Connection c;
			try//есть connection
			{
				c = _connections.First(x => x.OtherBody == rb);
				c.Add(wj);
			}
			catch (Exception)//нет connection
			{
				c = new Connection(rb);
				c.Add(wj);
				_connections.Add(c);//connection добавляем для обоих тел! М.К.
				bb._connections.Add(c);
			}
		}
Ejemplo n.º 7
0
 public void Add <T>(T entity) where T : class
 {
     _context.Add(entity);
 }