예제 #1
0
        /// <summary>Updates Target Informations.</summary>
        public void UpdateTargetInfos()
        {
            foreach (RssTargetInfo delInfo in _deletedRssInfos)
            {
                delInfo.RemoveDir();
            }
            _deletedRssInfos.Clear();

            foreach (RssTargetInfo info in _rssTargets)
            {
                info.Save();
            }

            foreach (RssTargetInfo info in _zeptDistTargets)
            {
                info.Save();
            }

            try
            {
                ThetisCore.Lib.IIpcTaskService ipcTaskService = ThetisCore.Lib.IpcServiceAgent.GetTaskService();
                if (ipcTaskService != null)
                {
                    ipcTaskService.FireEventRssTargetInfosUpdated();
                }
            }
            catch (Exception ex)
            {
                Log.AddError(ex.Message + "\n" + ex.StackTrace);
            }
        }
예제 #2
0
 /// <summary>Click event handler of each menu item.</summary>
 /// <param name="panel">Information Item Panel.</param>
 /// <param name="isRead">Flag whether read or not.</param>
 public void markRead(IInfoItemPanel panel, bool isRead)
 {
     if (isRead)
     {
         panel.MarkRead();
     }
     else
     {
         panel.MarkUnread();
     }
     try
     {
         ThetisCore.Lib.IIpcTaskService ipcTaskService = ThetisCore.Lib.IpcServiceAgent.GetTaskService();
         if (ipcTaskService != null)
         {
             ipcTaskService.SetRead(panel.GetInfoItem().Id, isRead);
         }
     }
     catch (Exception ex)
     {
         Log.AddError(ex.Message + "\n" + ex.StackTrace);
     }
 }
예제 #3
0
        /// <summary>Click event handler of the Trash Delete button.</summary>
        /// <param name="sender">Sender Object.</param>
        /// <param name="e">Event parameters.</param>
        private void btnTrashDelete_Click(object sender, RoutedEventArgs e)
        {
            TreeViewImgItem selItem = (TreeViewImgItem)trvTrash.SelectedItem;

            if (selItem == null)
            {
                return;
            }

            string selTitle = selItem.Text;

            if (selTitle.Length > 20)
            {
                selTitle = selTitle.Substring(0, 20) + " ...";
            }

            string msg = null;

            if (selItem.Type == TRASH_NODE_ITEM)
            {
                msg = "\"" + selTitle + "\"" + Properties.Resources.CONFIRM_COMPLETELY_DELETE;
            }
            else
            {
                msg = Properties.Resources.CONFIRM_COMPLETELY_ALL_DELETE_1 + "\"" + selTitle + "\"" + Properties.Resources.CONFIRM_COMPLETELY_ALL_DELETE_2;
            }

            System.Windows.Forms.DialogResult ret =
                System.Windows.Forms.MessageBox.Show(
                    msg,
                    this.Title,
                    System.Windows.Forms.MessageBoxButtons.OKCancel,
                    System.Windows.Forms.MessageBoxIcon.Question
                    );
            if (ret == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    ThetisCore.Lib.IIpcTaskService ipcTaskService = ThetisCore.Lib.IpcServiceAgent.GetTaskService();
                    if (ipcTaskService == null)
                    {
                        return;
                    }

                    if (selItem.Type == TRASH_NODE_ITEM)
                    {
                        InfoItem infoItem = (InfoItem)selItem.AdditionalInfo;
                        ipcTaskService.BurnUpTrash(infoItem.GeneratorId, new int[1] {
                            infoItem.Id
                        });

                        ((TreeViewImgItem)selItem.Parent).Items.Remove(selItem);
                    }
                    else if (selItem.Type == TRASH_NODE_CHANNEL)
                    {
                        if (selItem.Items.Count <= 0)
                        {
                            return;
                        }

                        string generatorId = null;
                        int[]  itemIds     = new int[selItem.Items.Count];

                        for (int i = 0; i < selItem.Items.Count; i++)
                        {
                            InfoItem infoItem = (InfoItem)((TreeViewImgItem)selItem.Items[i]).AdditionalInfo;
                            generatorId = infoItem.GeneratorId;
                            itemIds[i]  = infoItem.Id;
                        }
                        selItem.Items.Clear();

                        ipcTaskService.BurnUpTrash(generatorId, itemIds);
                    }
                    else if (selItem.Type == TRASH_NODE_TARGET)
                    {
                        foreach (TreeViewImgItem channel in selItem.Items)
                        {
                            if (channel.Items.Count <= 0)
                            {
                                continue;
                            }

                            string generatorId = null;
                            int[]  itemIds     = new int[channel.Items.Count];

                            for (int i = 0; i < channel.Items.Count; i++)
                            {
                                InfoItem infoItem = (InfoItem)((TreeViewImgItem)channel.Items[i]).AdditionalInfo;
                                generatorId = infoItem.GeneratorId;
                                itemIds[i]  = infoItem.Id;
                            }
                            channel.Items.Clear();

                            ipcTaskService.BurnUpTrash(generatorId, itemIds);
                        }
                    }
                }
                catch (System.Runtime.Remoting.RemotingException ex)
                {
                    Log.AddError(ex.Message + "\n" + ex.StackTrace);
                }
            }
        }