private void ListApps(string SearchBy, bool IsModule) { wrapApps.Children.Clear(); StackPanel stck = null; List <string> arrNamespace = new List <string>(); if (IsModule) { SearchBy = "module = '" + SearchBy + "'"; } else { SearchBy = "app like '%" + SearchBy + "%'"; } foreach (DataRow app in appList.dtApp.Select(SearchBy, "namespace ASC")) { string _namespace = app["namespace"].ToString(); if (arrNamespace.Contains(_namespace)) { cntrl.applicationIcon appIcon = appList.get_AppIcon(app); appIcon.Click += new cntrl.applicationIcon.ClickedEventHandler(open_App); appIcon.ClickedFav += new cntrl.applicationIcon.ClickedFavEventHandler(Add2Favorites); if (appIcon.HasReport) { appIcon.ReportClick += new cntrl.applicationIcon.ReportClickEventHandler(open_Report); } stck.Children.Add(appIcon); } else { stck = new StackPanel(); Label lbl = new Label(); Style style = Application.Current.FindResource("H2") as Style; lbl.Style = style; lbl.Foreground = Brushes.White; lbl.Effect = new DropShadowEffect { ShadowDepth = 0, BlurRadius = 2 }; stck.Children.Add(lbl); var appLocApplicationName = new LocTextExtension("Cognitivo:local:" + _namespace + "").SetBinding(lbl, Label.ContentProperty); cntrl.applicationIcon appIcon = appList.get_AppIcon(app); appIcon.Click += new cntrl.applicationIcon.ClickedEventHandler(open_App); appIcon.ClickedFav += new cntrl.applicationIcon.ClickedFavEventHandler(Add2Favorites); if (appIcon.HasReport) { appIcon.ReportClick += new cntrl.applicationIcon.ReportClickEventHandler(open_Report); } stck.Children.Add(appIcon); wrapApps.Children.Add(stck); arrNamespace.Add(_namespace); } } }
private void ListFav() { wrapApps.Children.Clear(); StackPanel stck = null; List <string> arrNamespace = new List <string>(); Properties.Settings Settings = new Properties.Settings(); foreach (string _Icon in Settings.AppFavList) { if (_Icon.Contains("Blank")) { continue; } string Ico = _Icon.Replace("Cognitivo.", ""); string SearchBy = "app like '%" + Ico + "%'"; foreach (DataRow app in appList.dtApp.Select(SearchBy, "namespace ASC")) { string _namespace = app["namespace"].ToString(); if (arrNamespace.Contains(_namespace)) { cntrl.applicationIcon appIcon = appList.get_AppIcon(app); appIcon.Click += new cntrl.applicationIcon.ClickedEventHandler(open_App); appIcon.ClickedFav += new cntrl.applicationIcon.ClickedFavEventHandler(Add2Favorites); stck.Children.Add(appIcon); } else { stck = new StackPanel(); Label lbl = new Label(); Style style = Application.Current.FindResource("H2") as Style; lbl.Style = style; lbl.Foreground = Brushes.White; lbl.Effect = new DropShadowEffect { ShadowDepth = 0, BlurRadius = 2 }; stck.Children.Add(lbl); var appLocApplicationName = new LocTextExtension("Cognitivo:local:" + _namespace + "").SetBinding(lbl, Label.ContentProperty); cntrl.applicationIcon appIcon = appList.get_AppIcon(app); appIcon.Click += new cntrl.applicationIcon.ClickedEventHandler(open_App); appIcon.ClickedFav += new cntrl.applicationIcon.ClickedFavEventHandler(Add2Favorites); stck.Children.Add(appIcon); wrapApps.Children.Add(stck); arrNamespace.Add(_namespace); } } } }
public void open_Report(object sender, RoutedEventArgs e) { cntrl.applicationIcon appName = (sender as cntrl.applicationIcon); string name = "Cognitivo.Reporting.Views." + appName.Uid; try { ApplicationWindow appWindow = new ApplicationWindow(); appWindow.appName = name; appWindow.Title = entity.Brillo.Localize.StringText(appName.Uid); appWindow.Icon = appName.imgSource; appWindow.Show(); } catch { } e.Handled = true; }
public cntrl.applicationIcon get_AppIcon(DataRow app) { string _namespace = app["namespace"].ToString(); string _app = app["app"].ToString(); string _name = app["name"].ToString(); string _img = app["img"].ToString(); string _description = "desc_" + app["name"].ToString(); string _HasReport = app["HasReport"].ToString(); cntrl.applicationIcon appIcon = new cntrl.applicationIcon(); //Checks if App has Inbuilt Report to show ReportIcon. This Helps save space. appIcon.HasReport = _HasReport == "1" ? true : false; ///AssemblyCheck. If reporting exists, don't add Cognitivo. appIcon.Tag = "Cognitivo." + _app; appIcon.Uid = _name; ///Security Check. try { entity.Brillo.Security security = new entity.Brillo.Security((entity.App.Names)Enum.Parse(typeof(entity.App.Names), _name, true)); if (security.view == false) { appIcon.IsEnabled = false; } } catch { appIcon.IsEnabled = false; } var appLocApplicationName = new LocTextExtension("Cognitivo:local:" + _name + "").SetBinding(appIcon, cntrl.applicationIcon.ApplicationNameProperty); //Incase img is not set, set it to DefaultIcon if (_img == "") { _img = "DefaultIcon"; } _img = "../Images/Application/128/" + _img + ".png"; appIcon.imgSource = new BitmapImage(new Uri(_img, UriKind.Relative)); return(appIcon); }
public void open_App(object sender, RoutedEventArgs e) { cntrl.applicationIcon appName = (sender as cntrl.applicationIcon); string name = appName.Tag.ToString(); if (Properties.Settings.Default.open_Window) { ApplicationWindow appWindow = new ApplicationWindow(); appWindow.appName = name; appWindow.Title = entity.Brillo.Localize.StringText(appName.Uid); appWindow.Icon = appName.imgSource; appWindow.Show(); } else { dynamic taskAuth = Task.Factory.StartNew(() => open_PageThread(name)); } e.Handled = true; }