public static Media CreateFrom(RegionOptions regionOptions) { UserControl widget = null; Media Backing = new Media(regionOptions.Width,regionOptions.Height,regionOptions.Top,regionOptions.Left); switch (regionOptions.Name) { case "CarInfo": widget = new CarInfo(); break; case "BatteryInfo": widget = new BatteryInfo(); break; case "LocationInfo": widget = new Location(); break; case "PersonalInfo": widget = new Profile(); break; default: break; } widget.Width = regionOptions.Width; widget.Height = regionOptions.Height; //MediaGrid.Width = Width; //MediaGrid.Height = Height; widget.HorizontalAlignment = HorizontalAlignment.Center; widget.VerticalAlignment = VerticalAlignment.Center; widget.Margin = new Thickness(0, 0, 0, 0); Backing.MediaCanvas.Children.Add(widget); Backing.HasOnLoaded = true; return Backing; }
static WidgetsFactory() { Widgets["PersonalInfo"] = new Profile(); Widgets["CarInfo"] = new CarInfo(); Widgets["BatteryInfo"] = new BatteryInfo(); Location location = new Location { Visibility = Visibility.Hidden }; Widgets["LocationInfo"] = location; }
public static Media CreateFrom(RegionOptions regionOptions) { UserControl element = null; Media media = new Media(regionOptions.Width, regionOptions.Height, regionOptions.Top, regionOptions.Left); if (Widgets.ContainsKey(regionOptions.Name)) { element = Widgets[regionOptions.Name]; } else { string name = regionOptions.Name; if (name != null) { if (!(name == "CarInfo")) { if (name == "BatteryInfo") { element = new BatteryInfo(); } else if (name == "LocationInfo") { element = new Location(); } else if (name == "PersonalInfo") { element = new Profile(); } } else { element = new CarInfo(); } } } element.Width = regionOptions.Width; element.Height = regionOptions.Height; element.HorizontalAlignment = HorizontalAlignment.Stretch; element.VerticalAlignment = VerticalAlignment.Stretch; element.Margin = new Thickness(0.0, 0.0, 0.0, 0.0); Canvas parent = element.Parent as Canvas; if (parent != null) { parent.Children.Remove(element); } media.MediaCanvas.Children.Add(element); media.HasOnLoaded = true; try { Widgets.Add(regionOptions.Name, element); } catch (Exception) { } return media; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.eADWindow = ((ClientApp.CustomerPage)(target)); return; case 2: this.FormFade = ((System.Windows.Media.Animation.Storyboard)(target)); return; case 3: this.FormFadeAnimation = ((System.Windows.Media.Animation.DoubleAnimation)(target)); return; case 4: this.FormFadeOut = ((System.Windows.Media.Animation.Storyboard)(target)); #line 34 "..\..\..\..\MainUI\CustomerPage.xaml" this.FormFadeOut.Completed += new System.EventHandler(this.FormFadeOut_Completed); #line default #line hidden return; case 5: this.FormFadeOutAnimation = ((System.Windows.Media.Animation.DoubleAnimation)(target)); return; case 6: this.LayoutRoot = ((System.Windows.Controls.Grid)(target)); return; case 7: this.CustomerProfile = ((ClientApp.Widgets.Profile)(target)); return; case 8: this.LocationWidget = ((ClientApp.Widgets.Location)(target)); return; case 9: this.CarInfoWidget = ((ClientApp.Widgets.CarInfo)(target)); return; case 10: this.BatteryInfoWidget = ((ClientApp.Widgets.BatteryInfo)(target)); return; } this._contentLoaded = true; }