Example #1
0
 public NewsArticleRepository(INewsReader iNewsReader, INewsUpdater iNewsUpdater, INewsCreator iNewsCreator, ISitecoreUtilities iSitecoreUtilities)
 {
     _iNewsReader        = iNewsReader;
     _iNewsUpdater       = iNewsUpdater;
     _iNewsCreator       = iNewsCreator;
     _iSitecoreUtilities = iSitecoreUtilities;
 }
Example #2
0
        public static readonly TimeSpan DefaultRefreshInterval = new TimeSpan(0, 15, 0); //refresh news every 15' min

        #region Methods

        public static void SetDefaults(INewsReader view)
        {
            //IView defaults and overrides
            ViewDefaults.SetDefaults(view);
            view.Title       = DefaultTitle;
            view.Width       = DefaultWidth;
            view.Height      = DefaultHeight;
            view.BorderColor = DefaultBorderColor;

            //INewsReader defaults
            view.Source          = DefaultSource;
            view.RefreshInterval = DefaultRefreshInterval;

            //Dirty flag
            view.Dirty = ViewDefaults.DefaultDirty; //must do last - this should be set again at the end of any SetDefaults method (at descendents)
        }
        public BaseWindow AddWindow(IWindowFactory windowFactory, bool newInstance = false)
        {
            try
            {
                BaseWindow w = windowFactory.CreateWindow();

                if (!newInstance)
                {
                    AddWindow(w);
                }
                else
                {                                                   //TODO: must change this scheme to remove hardcoded logic here, by using reverse binding order (source=container, target=component) when adding a new component manually than when loading saved state
                    TimeSpan      activityTime     = View.Time;     //Since settings Captions can change Time (jump to 0), must cache it here
                    CaptionRegion activityCaptions = View.Captions; //Since we use it at various if/else clauses below, better do this once here (doesn't cost much) to generate smaller compiled code

                    //for new child window instances (that the user adds), must reset their properties to match their containers so that they don't cause other components bound to the container to lose their Time/Captions when these get bound as sources to the container (which AddWindow does by calling BindWindow)
                    if (w is MediaPlayerWindow)
                    {
                        IMediaPlayer v = ((MediaPlayerWindow)w).MediaPlayerView;
                        //v.Captions = activityCaptions; //first set Captions, then Time //Note: this one is not needed since we added reverse binding logic for the Clip component (both at loading from saved state and for new one added in activity) - it doesn't store captions in its saved state
                        v.Time = activityTime;
                    }
                    else if (w is CaptionsWindow)
                    {
                        ICaptionsGrid v = ((CaptionsWindow)w).CaptionsGridView;
                        v.Captions = activityCaptions; //first set Captions, then Time
                        v.Time     = activityTime;
                    }
                    else if (w is TextEditorWindow)
                    {
                        ITextEditor2 v = ((TextEditorWindow)w).TextEditorView2;
                        //v.Captions = activityCaptions; //first set Captions, then Time
                        v.Time = activityTime;
                    }
                    else if (w is ImageWindow)
                    {
                        IImageViewer v = ((ImageWindow)w).ImageView;
                        v.Time = activityTime;
                    }
                    else if (w is MapWindow)
                    {
                        IMapViewer v = ((MapWindow)w).MapView;
                        //v.Captions = activityCaptions; //first set Captions, then Time
                        v.Time = activityTime;
                    }
                    else if (w is NewsWindow)
                    {
                        INewsReader v = ((NewsWindow)w).NewsView;
                        //v.Time = activityTime; //doesn't use the Time property
                    }
                    else if (w is BrowserWindow)
                    {
                        IBrowser v = ((BrowserWindow)w).BrowserView;
                        //v.Time = activityTime; //doesn't use the Time property
                    }
                    else if (w is GalleryWindow)
                    {
                        IGallery v = ((GalleryWindow)w).GalleryView;
                        //v.Time = activityTime; //doesn't use the Time property
                    }
                    AddWindowInViewCenter(w);
                };

                return(w);
            }
            catch (Exception e)
            {
                ErrorDialog.Show("Failed to create component", e);
                return(null);
            }
        }
Example #4
0
 public NewsUpdater(IFieldUpdater iFieldUpdater, INewsReader iNewsReader, ISitecoreUtilities iSitecoreUtilities)
 {
     _iFieldUpdater = iFieldUpdater;
     _iNewsReader = iNewsReader;
     _iSitecoreUtilities = iSitecoreUtilities;
 }
Example #5
0
 public NewsUpdater(IFieldUpdater iFieldUpdater, INewsReader iNewsReader, ISitecoreUtilities iSitecoreUtilities)
 {
     _iFieldUpdater      = iFieldUpdater;
     _iNewsReader        = iNewsReader;
     _iSitecoreUtilities = iSitecoreUtilities;
 }