namespace TrayApplication.Models
{
class AppInfoModel : PropertyNotifier
- {
+ {\r
+ private ImageVisual defaultVisual;
+ private GradientVisual gradientVisual;
+
public AppInfoModel(string name, string applicationId, string url)
{
Name = name;
}
}
- private void SetDefaultBackground()
+ private void SetDefaultImageVisual()
{
- ImageVisual imageVisual = new ImageVisual()
+ defaultVisual = new ImageVisual()
{
URL = Resources.GetImagePath() + "default_gradient.png",
};
- IconBackground = imageVisual.OutputVisualMap;
- imageVisual.Dispose();
}
- private void SetGradientBackground(PropertyArray stopColor)
+ private void SetGradientVisual(PropertyArray stopColor)
{
- GradientVisual gradientVisual = new GradientVisual()
+ gradientVisual = new GradientVisual()
{
StartPosition = new Vector2(0.0f, -1.0f),
EndPosition = new Vector2(0.0f, 1.0f),
StopColor = stopColor,
SpreadMethod = GradientVisualSpreadMethodType.Pad,
};
- IconBackground = gradientVisual.OutputVisualMap;
- gradientVisual.Dispose();
}
private PropertyArray GetGradientStopColors(Palette palette)
PropertyArray stopColor = GetGradientStopColors(palette);
if (stopColor.Count() < 2)
{
- Tizen.Log.Info(Resources.LogTag, "Palette or palatte values not valid, adding default gradient");
- SetDefaultBackground();
+ Tizen.Log.Info(Resources.LogTag, "Palette or palatte values not valid, adding default gradient");\r
+ SetDefaultImageVisual();
+ IconBackground = defaultVisual.OutputVisualMap;
}
else
{
Tizen.Log.Info(Resources.LogTag, "setting palette color");
- SetGradientBackground(stopColor);
+ SetGradientVisual(stopColor);\r
+ IconBackground = gradientVisual.OutputVisualMap;
}
+ }\r
+\r
+ ~AppInfoModel()\r
+ {\r
+ Tizen.Log.Info(Resources.LogTag, "Clearing NUI PropertyMap resources");\r
+ defaultVisual?.Dispose();\r
+ defaultVisual = null;\r
+ gradientVisual?.Dispose();\r
+ gradientVisual = null;\r
+ IconBackground?.Dispose();\r
+ IconBackground = null;\r
}
}
}
private void AddAppsApplication()
{
AppInfoModel appsApp = new AppInfoModel("Apps", AppsId, Resources.GetCurrentThemePath() + "apps.png");
- //appsApp.SetExtractedBackground(string.Empty);
+ appsApp.SetExtractedBackground(string.Empty);
Thread.Sleep(100);
appInfoModelDictionary.Add(AppsId, appsApp);
}
{
ApplicationInfo appInfo = new ApplicationInfo(appId);
AppInfoModel appInfoModel = new AppInfoModel(appInfo.Label, appId, appInfo.IconPath);
- //appInfoModel.SetExtractedBackground(appInfoModel.IconUrl);
+ appInfoModel.SetExtractedBackground(appInfoModel.IconUrl);
appInfoModelDictionary.Add(appId, appInfoModel);
appInfo.Dispose();
}