Exemplo n.º 1
0
        protected override void OnPropertyChanged(string propertyName)
        {
            base.OnPropertyChanged(propertyName);

            TaskBase owner = _owner;

            if (propertyName != "CheckedStatus" && propertyName != "State")
            {
                CheckedStatus = CheckedStatus.Unknown;
                if (owner != null)
                {
                    owner.CheckedStatus = CheckedStatus.Unknown;
                }
            }

            if (owner == null)
            {
                return;
            }

            TaskListServer tasks = owner.Owner as TaskListServer;

            if (tasks == null)
            {
                return;
            }

            IC1ReportsSchedulerWcfCallback callback = tasks.WcfCallback;

            if (callback != null)
            {
                try
                {
                    callback.ActionPropertyChanged(owner.Id, this.Id, ToProxyXml(), propertyName);
                }
                catch (Exception ex)
                {
                    IC1ReportsSchedulerWcf wcfService = tasks.WcfService;
                    if (wcfService != null)
                    {
                        wcfService.Disconnect(ex.Message);
                    }
                }
            }
        }
Exemplo n.º 2
0
 protected override void RemoveItem(int index)
 {
     lock (SyncRoot)
     {
         long id = ActionId(index);
         base.RemoveItem(index);
         TaskListServer tasks = _owner.Owner as TaskListServer;
         if (tasks == null)
         {
             return;
         }
         IC1ReportsSchedulerWcfCallback wcfCallback = tasks.WcfCallback;
         if (wcfCallback == null)
         {
             return;
         }
         wcfCallback.ActionRemoved(_owner.Id, id);
     }
 }
Exemplo n.º 3
0
        protected override void OnPropertyChanged(string propertyName)
        {
            base.OnPropertyChanged(propertyName);
            if (propertyName != "NextDueTime")
            {
                base.OnPropertyChanged("NextDueTime");
            }

            if (_owner == null)
            {
                return;
            }

            TaskListServer tasks = _owner.Owner as TaskListServer;

            if (tasks == null)
            {
                return;
            }

            IC1ReportsSchedulerWcfCallback callback = tasks.WcfCallback;

            if (callback != null)
            {
                try
                {
                    string xml = ToProxyXml();
                    callback.SchedulePropertyChanged(_owner.Id, xml, propertyName);
                    callback.SchedulePropertyChanged(_owner.Id, xml, "NextDueTime");
                }
                catch (Exception ex)
                {
                    IC1ReportsSchedulerWcf wcfService = tasks.WcfService;
                    if (wcfService != null)
                    {
                        wcfService.Disconnect(ex.Message);
                    }
                }
            }
        }
Exemplo n.º 4
0
 public TaskListHolderServer()
 {
     lock (SyncRoot)
         Tasks = new TaskListServer();
 }
Exemplo n.º 5
0
 public TaskServer(TaskListServer owner)
     : base(owner)
 {
 }
Exemplo n.º 6
0
        protected override void OnListChanged(ListChangedEventArgs e)
        {
            base.OnListChanged(e);

            TaskBase owner = _owner;

            if (owner == null)
            {
                return;
            }

            if (e.ListChangedType == ListChangedType.ItemAdded || e.ListChangedType == ListChangedType.ItemDeleted)
            {
                owner.CheckedStatus = CheckedStatus.Unknown;
            }

            TaskListServer tasks = owner.Owner as TaskListServer;

            if (tasks == null)
            {
                return;
            }

            IC1ReportsSchedulerWcfCallback wcfCallback = tasks.WcfCallback;

            if (wcfCallback == null)
            {
                return;
            }

            try
            {
                switch (e.ListChangedType)
                {
                case ListChangedType.ItemAdded:
                    try
                    {
                        ActionServer action = (ActionServer)this[e.NewIndex];
                        long         ownerId;
                        long         actionId;
                        string       xml;
                        lock (action.SyncRoot)
                        {
                            ownerId  = owner.Id;
                            actionId = action.Id;
                            xml      = action.ToProxyXml();
                        }
                        wcfCallback.ActionAdded(ownerId, e.NewIndex, actionId, xml);
                    }
                    catch (Exception ex)
                    {
                        AltUtil.ShowError(ex.Message);
                    }
                    break;

                case ListChangedType.ItemChanged:
                    try
                    {
                        ActionServer action = (ActionServer)this[e.NewIndex];
                        long         ownerId;
                        long         actionId;
                        string       xml;
                        lock (action.SyncRoot)
                        {
                            ownerId  = owner.Id;
                            actionId = action.Id;
                            xml      = action.ToProxyXml();
                        }
                        wcfCallback.ActionPropertyChanged(ownerId, actionId, xml, e.PropertyDescriptor.Name);
                    }
                    catch (Exception ex)
                    {
                        AltUtil.ShowError(ex.Message);
                    }
                    break;

                case ListChangedType.ItemDeleted:
                    // we need removed task's id, hence TaskRemoved must be called from RemoveItem override:
                    // wcfCallback.TaskRemoved(TaskId(e.NewIndex));
                    break;

                case ListChangedType.ItemMoved:
                    break;

                case ListChangedType.Reset:
                    break;
                }
            }
            catch (Exception ex)
            {
                AltUtil.ShowError(ex.Message);
                IC1ReportsSchedulerWcf wcfService = tasks.WcfService;
                if (wcfService != null)
                {
                    wcfService.Disconnect(ex.Message);
                }
            }
        }