示例#1
0
        public void Disconnect(bool saveOriginOnDisconnection, string fileName, bool exitOriginOnDisconnection)
        {
            if (IsConnected())
            {
                // Save the project if needed:
                if (saveOriginOnDisconnection)
                {
                    string strFileName = fileName;
                    if (!(strFileName.Length == 0))
                    {
                        _originApp.Save(strFileName);
                    }
                }

                // Exit Origin if needed:
                if (exitOriginOnDisconnection)
                {
                    ExecuteOriginCMD("exit");
                }

                System.Runtime.InteropServices.Marshal.ReleaseComObject(_originApp);
                _originApp = null;
            }

            return;
        }
示例#2
0
		public bool Connect(bool bConnectExisting)
		{
			if (IsConnected())
				return true;

			try
			{
				if (bConnectExisting)
					_originApp = new Origin.ApplicationSIClass();
				else
					_originApp = new Origin.ApplicationClass();
			}
			catch (Exception e)
			{
				ShowErrorMessage(e.Message);
			}

			bool bConnected = IsConnected();

			if (bConnected)
			{
				ShowOriginWindow(true);		// show or not Origin window

				_originSaveProjectFileName = GetSaveAsFileName();	// init file name for saving
			}
			else
			{
				_originApp = null;
				ShowErrorMessage("Failed to access Origin instance!");
			}
			return bConnected;
		}
示例#3
0
        public bool Connect(bool bConnectExisting)
        {
            if (IsConnected())
            {
                return(true);
            }

            try
            {
                if (bConnectExisting)
                {
                    _originApp = new Origin.ApplicationSIClass();
                }
                else
                {
                    _originApp = new Origin.ApplicationClass();
                }
            }
            catch (Exception e)
            {
                ShowErrorMessage(e.Message);
            }

            bool bConnected = IsConnected();

            if (bConnected)
            {
                ShowOriginWindow(true);                           // show or not Origin window

                _originSaveProjectFileName = GetSaveAsFileName(); // init file name for saving
            }
            else
            {
                _originApp = null;
                ShowErrorMessage("Failed to access Origin instance!");
            }
            return(bConnected);
        }
示例#4
0
		public void Disconnect(bool saveOriginOnDisconnection, string fileName, bool exitOriginOnDisconnection)
		{
			if (IsConnected())
			{
				// Save the project if needed:
				if (saveOriginOnDisconnection)
				{
					string strFileName = fileName;
					if (!(strFileName.Length == 0))
						_originApp.Save(strFileName);
				}

				// Exit Origin if needed:
				if (exitOriginOnDisconnection)
				{
					ExecuteOriginCMD("exit");
				}

				System.Runtime.InteropServices.Marshal.ReleaseComObject(_originApp);
				_originApp = null;
			}

			return;
		}