private static WidgetState CreateWidgetState(Widget widget) { var multiInstanceWidget = widget as IMultiInstanceWidget; if (multiInstanceWidget != null) { return new MultiInstanceWidgetState { Id = multiInstanceWidget.Id, Visible = multiInstanceWidget.Visibility, WidgetType = multiInstanceWidget.WidgetType.FullName, }; } return new WidgetState { Visible = widget.Visibility, WidgetType = widget.GetType().FullName, }; }
private static WidgetPersistentState CreateWidgetState(Widget widget) { var multiInstanceWidget = widget as IUserDefinedWidget; if (multiInstanceWidget != null) { var surprisePaymentWidget = multiInstanceWidget as SurprisePaymentWidget; if (surprisePaymentWidget == null) { return new MultiInstanceWidgetState { Id = multiInstanceWidget.Id, Visible = multiInstanceWidget.Visibility, WidgetType = multiInstanceWidget.WidgetType.FullName }; } return new SurprisePaymentWidgetPersistentState { Id = surprisePaymentWidget.Id, Visible = surprisePaymentWidget.Visibility, WidgetType = surprisePaymentWidget.WidgetType.FullName, PaymentStartDate = surprisePaymentWidget.StartPaymentDate, Frequency = surprisePaymentWidget.Frequency }; } return new WidgetPersistentState { Visible = widget.Visibility, WidgetType = widget.GetType().FullName }; }