public static void SetDefaults(ICaptionsGrid view) { //IView defaults and overrides ViewDefaults.SetDefaults(view); view.Title = DefaultTitle; view.Width = DefaultWidth; view.Height = DefaultHeight; view.BorderColor = DefaultBorderColor; //ICaptionsGrid defaults view.Source = DefaultSource; view.Captions = DefaultCaptions; view.ToolbarVisible = DefaultToolbarVisible; view.IndexVisible = DefaultIndexVisible; view.StartTimeVisible = DefaultStartTimeVisible; view.EndTimeVisible = DefaultEndTimeVisible; view.DurationVisible = DefaultDurationVisible; view.RoleVisible = DefaultRoleVisible; view.CaptionVisible = DefaultCaptionVisible; view.RTLVisible = DefaultRTLVisible; view.CPLVisible = DefaultCPLVisible; view.CPSVisible = DefaultCPSVisible; view.WPMVisible = DefaultWPMVisible; view.AudioVisible = DefaultAudioVisible; view.CommentsVisible = DefaultCommentsVisible; view.CommentsAudioVisible = DefaultCommentsAudioVisible; //view.SaveInvisibleAudio = DefaultSaveInvisibleAudio; view.LimitAudioPlayback = DefaultLimitAudioPlayback; view.LimitAudioRecording = DefaultLimitAudioRecording; view.DrawAudioDuration = DefaultDrawAudioDuration; //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); } }