2 using System.Collections.Generic;
6 using System.Windows.Controls;
7 using System.Windows.Data;
8 using System.Windows.Documents;
9 using System.Windows.Input;
10 using System.Windows.Media;
11 using System.Windows.Media.Imaging;
12 using System.Windows.Navigation;
13 using System.Windows.Shapes;
15 namespace SeciControls
26 private List<TextBlock>
_blocks =
new List<TextBlock>();
28 #region IsBigFontsProperty Dependency Property
30 public static readonly DependencyProperty
IsBigFontsProperty = DependencyProperty.RegisterAttached(
"IsBigFonts", typeof(Boolean),
31 typeof(
BlockDisplay),
new FrameworkPropertyMetadata(
false, FrameworkPropertyMetadataOptions.Inherits));
46 InitializeComponent();
51 _infoToDisplay.Clear();
52 if (names != null && names.GetLength(0) > 0)
54 for (
int i=0; i < names.GetLength(0); ++i)
56 if (Seci.Managers.BlockMgr.Blocks[names[i]].Visible)
58 _infoToDisplay.Add(names[i]);
65 this.Visibility = Visibility.Visible;
69 this.Visibility = Visibility.Collapsed;
75 #region IUpdate Members
79 for (
int i = 0; i < _infoToDisplay.Count; ++i)
83 String val = Seci.Managers.BlockMgr.GetFormattedBlockValue(
_infoToDisplay[i],
false,
false,
false);
86 if (!Seci.Managers.BlockMgr.Blocks[_infoToDisplay[i]].BlockEnabled)
90 else if (Seci.Managers.BlockMgr.Blocks[_infoToDisplay[i]].OutOfRange())
103 Console.WriteLine(e.Message);
110 stackPnl.Children.Clear();
137 var groups = Seci.Managers.BlockMgr.Groups;
138 if (groups.Count == 0 ||(groups.Count == 1 && groups[0].Name ==
"None"))
145 border.Child = tempWrap;
147 stackPnl.Children.Add(border);
149 for (
int i = 0; i < _infoToDisplay.Count; ++i)
153 tempWrap.Children.Add(temp);
159 Dictionary<String, WrapPanel> wraps =
new Dictionary<string, WrapPanel>();
168 List<string> used =
new List<string>();
170 for (
int i = 0; i < _infoToDisplay.Count; ++i)
172 if (!used.Contains(Seci.Managers.BlockMgr.Blocks[
_infoToDisplay[i]].Group))
178 foreach (Seci.Definitions.BlockGroup group in groups)
181 if (used.Contains(group.Name))
184 wraps.Add(group.Name, wrap);
189 stackPnl.Children.Add(border);
193 for (
int i = 0; i < _infoToDisplay.Count; ++i)
197 wraps[Seci.Managers.BlockMgr.Blocks[
_infoToDisplay[i]].Group].Children.Add(temp);
204 Border temp =
new Border();
205 temp.Style = (Style)FindResource(
"OuterBorderStyle");
211 TextBlock temp =
new TextBlock();
212 temp.Style = (Style)FindResource(
"StandardTextBlockStyle");
219 WrapPanel wrap =
new WrapPanel();
220 wrap.Style = (Style)FindResource(
"WrapPanelStyle");
222 if (!String.IsNullOrEmpty(name))
224 TextBlock temp =
new TextBlock();
225 temp.Style = (Style)FindResource(
"HeaderTextBlockStyle");
234 wrap.Children.Add(temp);
Interaction logic for BlockDisplay.xaml
static void SetIsBigFonts(UIElement element, Boolean value)
List< TextBlock > _blocks
List< String > _infoToDisplay
static readonly DependencyProperty IsBigFontsProperty
void SetBlocksToShow(String[] names)
static Boolean GetIsBigFonts(UIElement element)
TextBlock createTextBlock(String text)
WrapPanel setupWrapPanel(String name)