Esempio n. 1
0
        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 FbAction Create(FacebookAppEngine i_Engine, eTasksType i_taskToAutomate)
        {
            FbAction res = null;

            switch (i_taskToAutomate)
            {
            case eTasksType.Status:
                res = FbActionPost.Create(i_Engine);
                break;

            case eTasksType.Photo:
                res = FbActionPhoto.Create(i_Engine);
                break;

            case eTasksType.Link:
                res = FbActionLink.Create(i_Engine);
                break;
            }

            return(res);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        public static TimedComponent Create(FbEventArgs i_Args, FacebookAppEngine i_Engine, eTasksType i_ChosenTask)
        {
            TimedComponent timedComponent = new TimedComponent {
                FbEventArgs = i_Args, ActionObject = FbActionFactory.Create(i_Engine, i_ChosenTask), Timer = new System.Timers.Timer(), Invoked = false
            };

            timedComponent.ActionObject.LoadAction();
            timedComponent.Timer.Enabled  = false;
            timedComponent.Timer.Elapsed += new System.Timers.ElapsedEventHandler(timedComponent.OnElapsed);

            if ((timedComponent.FbEventArgs.Time - DateTime.Now).TotalMilliseconds > 0)
            {
                timedComponent.Timer.Interval = (timedComponent.FbEventArgs.Time - DateTime.Now).TotalMilliseconds;
            }
            else
            {
                // if the time already passed, we commit the action immediately
                timedComponent.Timer.Interval = 0.1;
            }

            return(timedComponent);
        }
 public TimedComponent CreateTimedComponent(FbEventArgs args, eTasksType taskType)
 {
     return(TimedComponent.Create(args, this, taskType));
 }