public static WeatherWidgetProvider2x2 GetInstance() { if (Instance == null) { Instance = new WeatherWidgetProvider2x2(); } return(Instance); }
public static void Init() { // Check prefs if (GetVersion() < CurrentPrefsVersion) { switch (GetVersion()) { case -1: // First time, so load all current widgets under Home location if (Settings.WeatherLoaded) { var mAppWidgetManager = AppWidgetManager.GetInstance(App.Context); var mAppWidget1x1 = WeatherWidgetProvider1x1.GetInstance(); var mAppWidget2x2 = WeatherWidgetProvider2x2.GetInstance(); var mAppWidget4x1 = WeatherWidgetProvider4x1.GetInstance(); var mAppWidget4x2 = WeatherWidgetProvider4x2.GetInstance(); var currentIds = new List <int>(); currentIds.AddRange(mAppWidgetManager.GetAppWidgetIds(mAppWidget1x1.ComponentName)); currentIds.AddRange(mAppWidgetManager.GetAppWidgetIds(mAppWidget2x2.ComponentName)); currentIds.AddRange(mAppWidgetManager.GetAppWidgetIds(mAppWidget4x1.ComponentName)); currentIds.AddRange(mAppWidgetManager.GetAppWidgetIds(mAppWidget4x2.ComponentName)); var homeLocation = Settings.HomeData; SaveIds(homeLocation.query, currentIds); } break; default: break; } // Set to latest version SetVersion(CurrentPrefsVersion); } }