private static PocoFrameRing ToPoco(this IFrameRing source, ConversionContext context)
		{
			if (source == null) return null;

			var poco = source as PocoFrameRing;
			if ((poco != null) || context.GetOrCreate(source, () => new PocoFrameRing(), out poco))
				return poco;

			source.CopyTo(poco, nameof(IFrameRing.RingItems));
			poco.PocoRingItems = source.RingItems.Select(entry => ToPoco(entry, context)).ToList();

			return poco;
		}
        public FrameRingPresenterWindow(string title, IFrameRing ring)
        {
            Owner = Application.Current.Windows.OfType <Window>().FirstOrDefault(x => !Equals(x, this) && x.IsFocused);
            if (Owner != null)
            {
                WindowStartupLocation = WindowStartupLocation.CenterOwner;
                Width  = Owner.Width * 0.95;
                Height = Owner.Height * 0.95;
            }
            InitializeComponent();
            Title          = title;
            Presenter.Ring = ring;

            CsGlobal.Local.Persistence.Ui.Store(this, $"{nameof(FrameRingPresenterWindow)}");
        }
Beispiel #3
0
 /// <summary>Analyses the <paramref name="ring" />.</summary>
 public static FrameAnalysis Analyse(this IFrameRing ring)
 {
     return(ring?.RingItems?.Analyse());
 }
		/// <summary>Converts the <see cref="IFrameRing" /> into a <see cref="PocoFrameRing" /> which is serializeable to json or binary.</summary>
		/// <param name="source">The <see cref="IFrameRing" /> to convert.</param>
		public static PocoFrameRing ToPoco(this IFrameRing source)
		{
			return source.ToPoco(new ConversionContext());
		}
 /// <summary>Shows the <paramref name="ring" /> in a new <see cref="Window" /> (ShowDialog blocks further program code).</summary>
 /// <param name="ring">The <see cref="IFrameRing" />.</param>
 /// <param name="title">The title of the <see cref="Window" />.</param>
 public static void ShowDialog(this IFrameRing ring, string title = null)
 {
     new FrameRingPresenterWindow(title.IsNullOrEmpty() ? "Page View" : title, ring).ShowDialog();
 }