예제 #1
0
        /// <summary>Click event handler of the Unread Checkbox.</summary>
        /// <param name="sender">Sender Object.</param>
        /// <param name="e">Event parameters.</param>
        private void chkUnread_Click(object sender, RoutedEventArgs e)
        {
            if (_infoItemPanel != null)
            {
                if ((bool)chkUnread.IsChecked)
                {
                    _infoItemPanel.MarkUnread();
                }
                else
                {
                    _infoItemPanel.MarkRead();
                }

                try
                {
                    ThetisCore.Lib.IIpcTaskService ipcTaskService = ThetisCore.Lib.IpcServiceAgent.GetTaskService();
                    if (ipcTaskService != null)
                    {
                        ipcTaskService.SetRead(_infoItemPanel.GetInfoItem().Id, !(bool)chkUnread.IsChecked);
                    }
                }
                catch (Exception ex)
                {
                    Log.AddError(ex.Message + "\n" + ex.StackTrace);
                }
            }
        }
예제 #2
0
        /// <summary>Removes the specified Information Items.</summary>
        /// <param name="itemIds">Array of IDs of the Information Items.</param>
        public void RemoveItems(int[] itemIds)
        {
            if (itemIds == null || itemIds.Length <= 0)
            {
                return;
            }

            try
            {
                ThetisCore.Lib.IIpcTaskService ipcTaskService = ThetisCore.Lib.IpcServiceAgent.GetTaskService();
                if (ipcTaskService != null)
                {
                    ipcTaskService.RemoveInfoItems(itemIds);
                }
            }
            catch (Exception ex)
            {
                Log.AddError(ex.Message + "\n" + ex.StackTrace);
            }
        }
예제 #3
0
        public static void SynchroTargets(string oldUrl, bool isRegexp, string newUrl, bool inheritSchemeIfExit, string userName, string password, bool synThetisRss, bool synZeptDist)
        {
            if (!newUrl.EndsWith(@"/"))
            {
                newUrl += @"/";
            }

            string rightPartFromHost = null;
            Match  m = Regex.Match(newUrl, @"^[ ]*[^:]+://(.+)");

            if (m.Success)
            {
                rightPartFromHost = m.Groups[1].Value;
            }

            RssTargetEntry[] entries         = RssTargetEntry.GetRssTargetsFromUrl(oldUrl, isRegexp);
            RssTargetEntry   targetThetisRss = entries[0];
            RssTargetEntry   targetZeptDist  = entries[1];

            if (synThetisRss)
            {
                if (targetThetisRss == null)
                {
                    targetThetisRss       = new RssTargetEntry();
                    targetThetisRss.Title = ThetisCore.Lib.Properties.Resources.THETIS_RSS;
                }
                else if (inheritSchemeIfExit)
                {
                    try
                    {
                        newUrl = String.Format(@"{0}://{1}", new Uri(targetThetisRss.Url).Scheme, rightPartFromHost);
                    }
                    catch (Exception) { }
                }
                targetThetisRss.Url = newUrl + @"feeds/index/";
                targetThetisRss.SetAuth(userName, password);

                targetThetisRss.Save();
            }
            if (synZeptDist)
            {
                if (targetZeptDist == null)
                {
                    targetZeptDist            = new RssTargetEntry();
                    targetZeptDist.Title      = ThetisCore.Lib.Properties.Resources.ZEPTAIR_DISTRIBUTION;
                    targetZeptDist.IsZeptDist = true;
                }
                else if (inheritSchemeIfExit)
                {
                    try
                    {
                        newUrl = String.Format(@"{0}://{1}", new Uri(targetZeptDist.Url).Scheme, rightPartFromHost);
                    }
                    catch (Exception) { }
                }
                targetZeptDist.Url = newUrl + @"feeds/zeptair_dist/";
                targetZeptDist.SetAuth(userName, password);

                targetZeptDist.Save();
            }
            if (synThetisRss || synZeptDist)
            {
                try
                {
                    ThetisCore.Lib.IIpcTaskService ipcTaskService = ThetisCore.Lib.IpcServiceAgent.GetTaskService();
                    if (ipcTaskService != null)
                    {
                        ipcTaskService.FireEventRssTargetInfosUpdated();
                    }
                }
                catch (Exception ex)
                {
                    Log.AddError(ex.Message + "\n" + ex.StackTrace);
                }
            }
        }