public static void Test() { User source = new User("ZhangSan"); User dest = CloneManager.Clone <User>(source); Debug.Assert(source.Name == dest.Name); }
/// <summary> /// Function: Get data from a object to current object /// Author : Jerry Xu /// Date : 2008-7-8 /// </summary> /// <param name="memory">LibraryAdapter</param> public override void FromTo(LibraryAdapter item) { //this.Caption = memory.Caption; base.FromTo(item); //TODO: AppointmentInfo adp = item as AppointmentInfo; _allDay = adp._allDay; _description = adp._description; _duration = adp._duration; _end = adp._end; _hasReminder = adp._hasReminder; _labelId = adp._labelId; _location = adp._location; _exactTiming = adp._exactTiming; _playMessageOnce = adp._playMessageOnce; if (adp._recurrenceInfo != null) { _recurrenceInfo = CloneManager.Clone <PWRecurrenceInfo>(adp._recurrenceInfo); } else { _recurrenceInfo = null; } _resourceId = adp._resourceId; _start = adp._start; _statusId = adp._statusId; _subject = adp._subject; _type = adp._type; }
private void simpleButton1_Click(object sender, EventArgs e) { SignInfo sign = new SignInfo(); textEdit2.Text = TemplateGroup.Default.Sign.Height.ToString(); sign.Template = CloneManager.Clone <TemplateGroup>(TemplateGroup.Default); sign.Template.Sign.Height = Convert.ToInt32(textEdit1.Text); bool b = sign.Template == TemplateGroup.Default; int i = TemplateGroup.Default.Sign.Height; }
public TemplateGroup Copy() { TemplateGroup clone = new TemplateGroup(); clone.Name = Name; clone._sign = CloneManager.Clone <SignTemplateInfo>(_sign); clone._scheduler = CloneManager.Clone <SchedulerTemplate>(_scheduler); clone._playlist = CloneManager.Clone <PlayListTemplate>(_playlist); clone._message = CloneManager.Clone <MessageTemplate>(_message); return(clone); }
private void btnProfileDuplicate_Click(object sender, EventArgs e) { if (lvWorkflows.SelectedItems.Count > 0) { ListViewItem lvi = lvWorkflows.SelectedItems[0]; Workflow wf = Workflows[(int)lvi.Tag]; IClone cm = new CloneManager(); Workflow wf2 = cm.Clone <Workflow>(wf); wf2.Description = wf.Description + " - Copy"; Workflows.Add(wf2); WorkflowsGuiRefresh(); } }
private void btnProfileDuplicate_Click(object sender, EventArgs e) { if (lvWorkflows.SelectedItems.Count > 0) { ListViewItem lvi = lvWorkflows.SelectedItems[0]; Workflow wf = Workflows[(int)lvi.Tag]; IClone cm = new CloneManager(); Workflow wf2 = cm.Clone<Workflow>(wf); wf2.Description = wf.Description + " - Copy"; Workflows.Add(wf2); WorkflowsGuiRefresh(); } }
private void simpleButton1_Click(object sender, EventArgs e) { TemplateGroup test = new TemplateGroup(); test = CloneManager.Clone <TemplateGroup>(TemplateGroup.Default); test.Sign.Height = 210; //List<string> names = new List<string>(); //names.Add("AAAA"); //names.Add("BBBB"); //names.Add("CCCC"); //names.Add("DDDD"); //names.Add("EEEE"); //names.Add("FFFFF"); //names.Add("GGGGG"); //ListForm listForm = new ListForm("NameList", names); //if(listForm.ShowDialog() == DialogResult.OK) //{ // labelControl1.Text = listForm.SelectedName; //} }
public T Clone <T>(T objectToClone) where T : class, IObjectBase { return(CloneManager.Clone(objectToClone)); }
/// <summary> /// Connect /// </summary> private void DoConnect() { if (connStatus != null) { return; } if (isUseProxy && ddlProxyType.SelectedIndex != 0) { if (txtProxyIpAdd.Text.Trim() == "") { MsgBox.Warning("Sorry,the proxy IP address can't be empty"); return; } if (this.txtProxyPortNo.Text.Trim() == "") { MsgBox.Warning("Sorry,the proxy port number can't be empty"); return; } } Cursor = Cursors.WaitCursor; ConnectionExceptionAction.IsCancel = false; IsDisconnection = false; DashboardTree._currentSign = Current; IPEndPoint endPoint = null; IPEndPoint proxyEndPoint = null; LoginInfo info = new LoginInfo(); if (Current.Template.Sign.AutoLogin || Current.LoginInfomation.CanSave || Current.LoginInfomation.CanSaveLoginInfo) { info = CloneManager.Clone <LoginInfo>(Current.LoginInfomation); } if (chkStorePWD.Checked) { info.CanSave = true; } else { info.CanSave = false; } info.IpAddress = txtConnectIpAddress.Text.Trim(); info.Port = Convert.ToInt32(txtConnectPortNo.Text); info.ConnectionUserName = txtServerName.Text.Trim(); info.ConnectionPassword = txtConnectPWD.Text.Trim(); Current.LoginInfomation.ConnectionUserName = txtServerName.Text.Trim(); Current.LoginInfomation.ConnectionPassword = txtConnectPWD.Text.Trim(); endPoint = new IPEndPoint(IPAddress.Parse(info.IpAddress), info.Port); if (isUseProxy && ddlProxyType.SelectedIndex != 0) { info.PorxyUserName = txtProxyUserName.Text; info.ProxyPort = Convert.ToInt32(txtProxyPortNo.Text); info.PorxyAddress = txtProxyIpAdd.Text; info.ProxyType = (ProxyTypes)Enum.Parse(typeof(ProxyTypes), ddlProxyType.SelectedItem.ToString()); info.PorxyPassword = txtProxyPWD.Text; proxyEndPoint = new IPEndPoint(IPAddress.Parse(this.txtProxyIpAdd.Text), Convert.ToInt32(this.txtProxyPortNo.Text)); } else { info.ProxyType = ProxyTypes.None; } Current.LoginInfomation = info; Current.Controller.Connection.FtpUser.Account = info.ConnectionUserName; Current.Controller.Connection.FtpUser.NoSecurityPWD = info.ConnectionPassword; TcpUFEConnection tcpConn = Current.Controller.Connection as TcpUFEConnection; if (tcpConn != null) { var connParams = new TcpConnectionParams(endPoint, proxyEndPoint, info.ProxyType, info.PorxyUserName, info.PorxyPassword); tcpConn.Params = connParams; } ProWrite.UI.Controls.Actions.UFE.Responses.UFEResponseService.Init(Current); this.Hide(); ConnectionProgress progress = new ConnectionProgress(Current, false, info.ConnectionPassword); progress.ShowModalDialog(); if (!chkStorePWD.Checked) { Current.LoginInfomation.ConnectionPassword = ""; } if (progress.Result) { LiveImageAction liveImageAction = new LiveImageAction(); liveImageAction.Sign = Current; liveImageAction.Perform(); StatusAction statusAction = new StatusAction(false); statusAction.Sign = Current; statusAction.Perform(); GetStatusAction getStatus = new GetStatusAction(); getStatus.sign = Current; getStatus.Perform(); LogViewAction logviewAction = new LogViewAction(); logviewAction.sign = Current; logviewAction.Perform(); if (Current.IsWebCam) { IsConnectWebCam = true; } UpdateSignInfo(); } else { ActionHelper.OnDisconnected(false); this.Show(); this.Cursor = Cursors.Default; } }
public WorkerTask(Workflow wf, bool cloneWorkflow = true) { Info = new TaskInfo(); UploadResults = new List<UploadResult>(); Errors = new List<string>(); States.Add(TaskState.Created); MyWorker = new BackgroundWorker { WorkerReportsProgress = true }; if (cloneWorkflow) { IClone cm = new CloneManager(); WorkflowConfig = cm.Clone(wf); } else { WorkflowConfig = wf; } }