AEMManager.AemInstance.Clone C# (CSharp) Method

Clone() public method

public Clone ( ) : AemInstance
return AemInstance
        public AemInstance Clone()
        {
            AemInstance clone = new AemInstance();

              clone.mAemInstanceType = mAemInstanceType;
              clone.mName = mName;
              clone.mHostname = mHostname;
              clone.mPort = mPort;
              clone.mContextPath = mContextPath;
              clone.mPath = mPath;
              clone.mJavaExecutable = mJavaExecutable;
              clone.mUsername = mUsername;
              clone.mPassword = mPassword;
              clone.mRunmode = mRunmode;
              clone.mAdditionalRunmodes = mAdditionalRunmodes;
              clone.mRunmodeSampleContent = mRunmodeSampleContent;
              clone.mIconSet = mIconSet;
              clone.mCustomIconPath = mCustomIconPath;
              clone.mShowInTaskbar = mShowInTaskbar;
              clone.mHeapMinSizeMb = mHeapMinSizeMb;
              clone.mHeapMaxSizeMb = mHeapMaxSizeMb;
              clone.mMaxPermSizeMb = mMaxPermSizeMb;
              clone.mJVMDebug = mJVMDebug;
              clone.mDebugPort = mDebugPort;
              clone.mJProfiler = mJProfiler;
              clone.mJProfilerPort = mJProfilerPort;
              clone.mJConsole = mJConsole;
              clone.mJConsolePort = mJConsolePort;
              clone.mHideConfigWizard = mHideConfigWizard;
              clone.mShowInstanceWindow = mShowInstanceWindow;
              clone.mOpenBrowser = mOpenBrowser;
              clone.mRemoteProcess = mRemoteProcess;
              clone.mCustomJVMParam1Active = mCustomJVMParam1Active;
              clone.mCustomJVMParam1 = mCustomJVMParam1;
              clone.mCustomJVMParam2Active = mCustomJVMParam2Active;
              clone.mCustomJVMParam2 = mCustomJVMParam2;
              clone.mCustomJVMParam3Active = mCustomJVMParam3Active;
              clone.mCustomJVMParam3 = mCustomJVMParam3;
              clone.mBrowserExecutable = mBrowserExecutable;

              return clone;
        }

Usage Example

Example #1
0
        private void copyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AemInstance instance = this.SelectedInstanceInListview;

            if (instance == null)
            {
                return;
            }
            instance      = instance.Clone();
            instance.Name = "Copy of " + instance.Name;
            AemInstanceDialog dialog = new AemInstanceDialog(instance);

            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                instance.Save();
                Program.InstanceList.Add(instance);
                Program.InstanceList.SortByName();
                Program.UpdateInstanceListInViews();
            }
            else
            {
                // remove instance icon because instance not saved
                instance.NotifyIcon.Visible = false;
                instance.NotifyIcon.Dispose();
                instance.NotifyIcon = null;
            }
        }