private void addATimedCommandToCommit() { if (listBoxActions.SelectedItem != null) { IProxyForm CommandForm = listBoxActions.SelectedItem as IProxyForm; DialogResult dialogResult = CommandForm.ShowDialog(); if (dialogResult == DialogResult.OK) { IfbAutomatable fbTaskToAutomate = CommandForm as IfbAutomatable; FbEventArgs args = fbTaskToAutomate?.CollectData(); eTasksType taskType = (eTasksType)fbTaskToAutomate?.GetTaskType(); TimedComponent timedComponent = m_FacebookApp.CreateTimedComponent(args, taskType); timedComponent.ActionObject.DoWhenFinishedError += (i_object, i_e) => MessageBox.Show(string.Format("there was a probloem during invoking the {0} action", timedComponent.ActionObject.GetName())); IControl s = new CheckBoxedTimedComponentUIControl(new TimedComponentUIControl(timedComponent)); m_TimedComponentsNotYetInvoked.Add(s); flowLayoutPanel1.Controls.Add(s.CreateUIControl()); timedComponent.Timer.Elapsed += (i_object, i_e) => s.Update(); timedComponent.Timer.Start(); } } }
public static IProxyForm Create(eTasksType i_TaskToAutomate) { IProxyForm res = null; switch (i_TaskToAutomate) { case eTasksType.Status: res = FormPostStatusProxy.Create(); break; case eTasksType.Photo: res = FormPostPhotoProxy.Create(); break; case eTasksType.Link: res = FormPostLinkProxy.Create(); break; } return(res); }