/// <summary> /// Does the binding test. /// </summary> private void DoBindingTest() { TextBlock tb = new TextBlock(); LocTextExtension loc = new LocTextExtension("XamlLocalizationTest:ResTexts:resBack"); // should be true bool success = loc.SetBinding(tb, TextBlock.TextProperty); // should be false success = loc.SetBinding(tb, TextBlock.TextProperty); tb = null; tb = new TextBlock(); // should be true success = loc.SetBinding(tb, TextBlock.TextProperty); tb = null; tb = new TextBlock(); // should be true success = loc.SetBinding(tb, TextBlock.TextProperty); // should be false success = loc.SetBinding(tb, TextBlock.TextProperty); }
public StackPanel get_ConfigIcon(DataRow app) { string _app = app["app"].ToString(); string _namespace = app["namespace"].ToString(); string _img = app["img"].ToString(); string _description = app["desc"].ToString(); //int module = (int)app["id"]; TextBlock txtApp = new TextBlock(); txtApp.Style = (Style)Application.Current.FindResource("text_HyperLinks"); var appLocTextExtension = new LocTextExtension("COGNITIVO:local:" + _app + "").SetBinding(txtApp, TextBlock.TextProperty); txtApp.FontSize = 16; Thickness margin_txtApp = txtApp.Margin; margin_txtApp.Left = 5; txtApp.Margin = margin_txtApp; Image img = new Image(); //Incase img is not set, set it to DefaultIcon _img = "../Images/Application/128/" + (_img == "" ? _img : "DefaultIcon") + ".png"; img.Stretch = Stretch.UniformToFill; img.Width = 26; img.Height = 26; img.Source = new BitmapImage(new Uri(_img, UriKind.Relative)); StackPanel stckIcon = new StackPanel(); stckIcon.Orientation = Orientation.Horizontal; stckIcon.Children.Add(img); stckIcon.Children.Add(txtApp); StackPanel stckApp = new StackPanel(); stckApp.Children.Add(stckIcon); if (_description != "") { TextBlock txtDesc = new TextBlock(); txtDesc.Style = (Style)Application.Current.FindResource("text_Instructions"); var descLocTextExtension = new LocTextExtension("COGNITIVO:local:" + _description + ""). SetBinding(txtDesc, TextBlock.TextProperty); Thickness margin_txtDesc = txtDesc.Margin; margin_txtDesc.Left = 31; txtDesc.Margin = margin_txtDesc; stckApp.Children.Add(txtDesc); } Thickness margin_stckApp = stckApp.Margin; margin_stckApp.Left = 32; margin_stckApp.Right = 32; margin_stckApp.Top = 32; margin_stckApp.Bottom = 32; txtApp.Margin = margin_stckApp; stckApp.Tag = _namespace + "." + _app; //stckApp.Uid = module.ToString(); return(stckApp); }
/// <summary> /// Handles the Loaded event of the Window1 control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void Window1_Loaded(object sender, RoutedEventArgs e) { // <TextBlock x:Name="txtSizeNormal" Grid.Column="3" Grid.Row="1" Text="{LocText XamlLocalizationTest:ResTexts:resBack, Prefix=AbC, Suffix=AbC, PrefixSpace=true, SuffixSpace=true}" /> // <TextBlock x:Name="txtSizeUpper" Grid.Column="3" Grid.Row="2" Text="{LocTextUpper XamlLocalizationTest:ResTexts:resBack, Prefix=AbC, Suffix=AbC, PrefixSpace=true, SuffixSpace=true}" /> // <TextBlock x:Name="txtSizeLower" Grid.Column="3" Grid.Row="3" Text="{LocTextLower XamlLocalizationTest:ResTexts:resBack, Prefix=AbC, Suffix=AbC, PrefixSpace=true, SuffixSpace=true}" /> bool txtNormalBinding = new LocTextExtension("XamlLocalizationTest:ResTexts:resBack") { Prefix = "AbC ", Suffix = " AbC" } .SetBinding(this.txtSizeNormal, TextBlock.TextProperty); bool txtUpperBinding = new LocTextUpperExtension("XamlLocalizationTest:ResTexts:resBack") { Prefix = "AbC ", Suffix = " AbC" } .SetBinding(this.txtSizeUpper, TextBlock.TextProperty); bool txtLowerBinding = new LocTextLowerExtension("XamlLocalizationTest:ResTexts:resBack") { Prefix = "AbC ", Suffix = " AbC" } .SetBinding(this.txtSizeLower, TextBlock.TextProperty); this.DoBindingTest(); this.CheckBitmapResolving(); }
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); } } }
public string GetUIString(string key) { string uiString; LocTextExtension locEx = new LocTextExtension(key); locEx.ResolveLocalizedValue(out uiString); return(uiString); }
public static string GetUIString(string key) { string uiString; LocTextExtension locExtension = new LocTextExtension(String.Format("FreeDriverScout.OSMigrationTool.Backup:Resources:{0}", key)); locExtension.ResolveLocalizedValue(out uiString); return(uiString); }
public static string GetUIString(string key) { string uiString; LocTextExtension locExtension = new LocTextExtension(String.Format("DriversGalaxy.OSMigrationTool.Restore:Resources:{0}", key)); locExtension.ResolveLocalizedValue(out uiString); return(uiString); }
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); } } } }
private void get_Icons(string mod_name, ref entity.Brillo.Security security) { toolBarData t = new toolBarData(); foreach (DataRow row in t.dtIconList_property.Select("modIcon = '" + mod_name + "'")) { toolIcon_Mini ico = new toolIcon_Mini(); string _toolTip = row["tooltip"].ToString(); var appLocTextExtension = new LocTextExtension("COGNITIVO:local:" + _toolTip + "").SetBinding(ico, toolIcon_Mini.icoNameProperty); ico.imgSource = row["img"].ToString(); ico.Cursor = Cursors.Hand; ico.btnColor = Brushes.AliceBlue; ico.iColor = Brushes.RoyalBlue; ico = check_Icons(ico, _toolTip, ref security); if (ico != null && row["placement"].ToString() == "m") { if (_toolTip == "Delete") { ico.btnColor = Brushes.Silver; ico.iColor = Brushes.Black; System.Windows.Shapes.Rectangle rect; rect = new System.Windows.Shapes.Rectangle(); rect.Fill = new SolidColorBrush(Colors.Gainsboro); rect.Width = 0.5; rect.Margin = new Thickness(4); stackMain.Children.Add(rect); stackMain.Children.Add(ico); } else { stackMain.Children.Add(ico); } } else if (ico != null && row["placement"].ToString() == "s") { //Then Secondary Stack if (_toolTip == "Annul") { ico.btnColor = Brushes.Pink; ico.iColor = Brushes.Crimson; } else if (_toolTip == "Approve") { ico.btnColor = Brushes.PaleGreen; ico.iColor = Brushes.Green; } stackSide.Children.Add(ico); } } }
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 toolMessage(msgType _msgType) { InitializeComponent(); // Add any initialization after the InitializeComponent() call. bool _btnClose = false; bool _btnYes = false; bool _btnNo = false; if (_msgType == msgType.msgError) { Status_Colour.Fill = Brushes.Crimson; shortMessage = "Error"; _btnClose = true; } else if (_msgType == msgType.msgApproved) { Status_Colour.Fill = Brushes.Green; shortMessage = "Approve"; _btnClose = true; //OnClose_MsgBox(); _btnYes = false; _btnNo = false; } else if (_msgType == msgType.msgAnnulled) { Status_Colour.Fill = Brushes.Crimson; shortMessage = "Annul"; //OnClose_MsgBox(); _btnClose = true; _btnYes = false; _btnNo = false; } else if (_msgType == msgType.msgQuestion) { Status_Colour.Fill = Brushes.Purple; shortMessage = "Question"; _btnYes = false; _btnNo = false; } else if (_msgType == msgType.msgSaved) { Status_Colour.Fill = Brushes.PaleGreen; shortMessage = "Saved"; _btnClose = true; //OnClose_MsgBox(); } else if (_msgType == msgType.msgDeleted) { Status_Colour.Fill = Brushes.PaleGreen; shortMessage = "Deleted"; _btnClose = true; } else if (_msgType == msgType.msgWarning) { Status_Colour.Fill = Brushes.Gold; shortMessage = "Warning"; _btnClose = true; //OnClose_MsgBox(); } if (_btnClose) { Label btnClose = new Label(); btnClose.FontWeight = FontWeights.Thin; btnClose.FontSize = 15; btnClose.Cursor = Cursors.Hand; btnClose.VerticalAlignment = VerticalAlignment.Center; btnClose.HorizontalAlignment = HorizontalAlignment.Center; dynamic LocTextExtensionClose = new LocTextExtension("Cognitivo:local:Cancel").SetBinding(btnClose, ContentProperty); btnClose.MouseUp += btnClose_MouseUp; stackQuestion.Children.Add(btnClose); } if (_btnYes | _btnNo) { Label btnYes = new Label(); btnYes.FontWeight = FontWeights.Thin; btnYes.FontSize = 15; btnYes.Cursor = Cursors.Hand; btnYes.VerticalAlignment = VerticalAlignment.Center; btnYes.HorizontalAlignment = HorizontalAlignment.Center; dynamic LocTextExtensionYes = new LocTextExtension("Cognitivo:local:Yes").SetBinding(btnYes, ContentProperty); btnYes.MouseUp += btnYes_MouseUp; stackQuestion.Children.Add(btnYes); Label btnNo = new Label(); btnNo.FontWeight = FontWeights.Thin; btnNo.FontSize = 15; btnNo.Cursor = Cursors.Hand; btnNo.VerticalAlignment = VerticalAlignment.Center; btnNo.HorizontalAlignment = HorizontalAlignment.Center; dynamic LocTextExtensionNo = new LocTextExtension("Cognitivo:local:No").SetBinding(btnNo, ContentProperty); btnNo.MouseUp += btnNo_MouseUp; stackQuestion.Children.Add(btnNo); } }