Exemplo n.º 1
0
 private void ChangeThickness(object sender, SelectionChangedEventArgs args)
 {
     var li = ((sender as ListBox).SelectedItem as ListBoxItem);
     var myThicknessConverter = new System.Windows.ThicknessConverter();
     var th1 = (Thickness) myThicknessConverter.ConvertFromString(li.Content.ToString());
     border1.BorderThickness = th1;
     bThickness.Text = "Border.BorderThickness =" + li.Content;
 }
Exemplo n.º 2
0
		public void ChangeMargin(object sender, SelectionChangedEventArgs args)
		{
			ListBoxItem li = ((sender as ListBox).SelectedItem as ListBoxItem);
            ThicknessConverter myThicknessConverter = new ThicknessConverter();
            Thickness th1 = (Thickness)myThicknessConverter.ConvertFromString(li.Content.ToString());
            text1.Margin = th1;
            String st1 = (String)myThicknessConverter.ConvertToString(text1.Margin);
            gridVal.Text = "The Margin property is set to " + st1 +".";
		}
Exemplo n.º 3
0
        private void ChangeThickness(object sender, SelectionChangedEventArgs args)
        {
            var li = ((sender as ListBox).SelectedItem as ListBoxItem);
            var myThicknessConverter = new System.Windows.ThicknessConverter();
            var th1 = (Thickness)myThicknessConverter.ConvertFromString(li.Content.ToString());

            border1.BorderThickness = th1;
            bThickness.Text         = "Border.BorderThickness =" + li.Content;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Converts source values to a value for the binding target. The data binding engine calls this method when it propagates the values from source bindings to the binding target.
        /// </summary>
        /// <returns>
        /// A converted value.If the method returns null, the valid null value is used.A return value of <see cref="T:System.Windows.DependencyProperty"/>.<see cref="F:System.Windows.DependencyProperty.UnsetValue"/> indicates that the converter did not produce a value, and that the binding will use the <see cref="P:System.Windows.Data.BindingBase.FallbackValue"/> if it is available, or else will use the default value.A return value of <see cref="T:System.Windows.Data.Binding"/>.<see cref="F:System.Windows.Data.Binding.DoNothing"/> indicates that the binding does not transfer the value or use the <see cref="P:System.Windows.Data.BindingBase.FallbackValue"/> or the default value.
        /// </returns>
        /// <param name="values">The array of values that the source bindings in the <see cref="T:System.Windows.Data.MultiBinding"/> produces. The value <see cref="F:System.Windows.DependencyProperty.UnsetValue"/> indicates that the source binding has no value to provide for conversion.</param><param name="targetType">The type of the binding target property.</param><param name="parameter">The converter parameter to use.</param><param name="culture">The culture to use in the converter.</param>
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values.Any(x => x == DependencyProperty.UnsetValue))
            {
                if (parameter != null)
                {
                    return((Thickness)systemThicknessConverter.ConvertFromString((string)parameter));
                }

                return(new Thickness());
            }

            return(new Thickness(System.Convert.ToDouble(values[0]), System.Convert.ToDouble(values[1]), System.Convert.ToDouble(values[2]), System.Convert.ToDouble(values[3])));
        }
Exemplo n.º 5
0
		private double CreateFieldDefinitions (Grid ButtonGrid)
			{
			GridLengthConverter GLConverter = new GridLengthConverter ();
			ThicknessConverter TConverter = new ThicknessConverter ();
			BrushConverter BConverter = new BrushConverter ();
			int RowIndex = 0;
			int NumberOfAllLines = 0;
			double LineHeight = -1;
			foreach (DataColumn Column in m_RowToProcess.Table.Columns)
				{
				if (Column.ColumnName == UserData.m_PrimaryKeyName)
					continue;
				int NumberOfLines = GetNumberOfLines (Column);
				Label ColumnLabel = new Label ();
				ButtonGrid.Children.Add (ColumnLabel);
				Grid.SetColumn (ColumnLabel, 0);
				Grid.SetRow (ColumnLabel, RowIndex);
				ColumnLabel.VerticalAlignment = VerticalAlignment.Top;
				if (String.IsNullOrEmpty (Column.Caption))
					ColumnLabel.Content = Column.ColumnName;
				else
					ColumnLabel.Content = Column.Caption;
				if (m_TableLayoutDefinition.LabelFontSize != -1)
					ColumnLabel.FontSize = m_TableLayoutDefinition.LabelFontSize;
				if (LineHeight == -1)
					{
					ColumnLabel.UpdateLayout ();
					LineHeight = ColumnLabel.DesiredSize.Height;
					}
				Border TextBlockBorder = new Border ();
				ButtonGrid.Children.Add (TextBlockBorder);
				TextBlockBorder.HorizontalAlignment = HorizontalAlignment.Stretch;
				TextBlockBorder.VerticalAlignment = VerticalAlignment.Stretch;
				Grid.SetColumn (TextBlockBorder, 1);
				Grid.SetRow (TextBlockBorder, RowIndex);
				TextBlockBorder.BorderThickness = (Thickness)TConverter.ConvertFromString ("1");
				TextBlockBorder.BorderBrush = (Brush)BConverter.ConvertFromString ("Black");
				if ((Column.DataType.ToString () == "System.String")
					|| (Column.DataType.ToString () == "System.Guid"))
					ProcessStringField (ButtonGrid, TextBlockBorder, Column,
								RowIndex, LineHeight, NumberOfLines);
				NumberOfAllLines += NumberOfLines;
				RowIndex++;
				}
			return (double)((NumberOfAllLines + 2) * LineHeight) + (NumberOfAllLines * 2);
			}
Exemplo n.º 6
0
		private bool ProcessMessageFunction (String CommandFileName, XmlNode Command)
			{
			String ShowOrHide = Command.Attributes [CVM.CommonValues.CONFIG_MANAGER_TYPE].Value;
			if (ShowOrHide == CVM.CommonValues.CONFIG_MANAGER_TYPE_HIDE_MESSAGE)
				{
				if (m_MessageForm != null)
					{
					m_MessageForm.Close ();
					m_MessageForm = null;
					return true;
					}
				}
			XmlNode MessageTextNode = Command.SelectSingleNode ("child::" + CVM.CommonValues.CONFIG_MANAGER_EXECUTEABLE);
			if (MessageTextNode == null)
				{
				WMB.Basics.ReportErrorToEventViewer ("WPMediaSystemManager.ProcessMessageFunction",
						"Es fehlt der \"" + CVM.CommonValues.CONFIG_MANAGER_EXECUTEABLE + "\" Eintrag " +
						CommandFileName);
				return true;
				}
			BrushConverter BRConverter = new BrushConverter ();
			ThicknessConverter TIConverter = new ThicknessConverter ();
			if (m_MessageForm == null)
				{
				m_MessageForm = new Window ();
				m_MessageForm.Left = 0;
				m_MessageForm.Top = 0;
				System.Drawing.Rectangle ScreenRect = CVM.CommonValues.ConvertPhysicalScreenBounds (CVM.CommonValues.GetPhysicalScreenBounds ()) [0];
				m_MessageForm.Width = ScreenRect.Width;
				m_MessageForm.Height = ScreenRect.Height;
				m_MessageForm.Background = (Brush) BRConverter.ConvertFromString ("Blue");
				m_MessageForm.WindowStyle = System.Windows.WindowStyle.None;
				m_MessageForm.Icon = null;
				m_MessageForm.Topmost = true;
				m_MessageForm.Cursor = Cursors.Wait;
				}
			if (m_MessageForm.Content != null)
				{
				m_MessageForm.Content = null;
				}
			Grid RootGrid = m_XAMLHandling.CreateGrid (new int [] { 2, 10, 2 }, new int [] { 2, 8, 2 });
			m_MessageForm.Content = RootGrid;
			System.Windows.Controls.TextBox MessageTextBox = new TextBox ();
			RootGrid.Children.Add (MessageTextBox);
			Grid.SetColumn (MessageTextBox, 1);
			Grid.SetRow (MessageTextBox, 1);
			MessageTextBox.Text = MessageTextNode.InnerText;
			MessageTextBox.TextAlignment = TextAlignment.Center;
			MessageTextBox.TextWrapping = TextWrapping.Wrap;
			MessageTextBox.Foreground = (Brush) BRConverter.ConvertFromString ("White");
			MessageTextBox.Background = (Brush) BRConverter.ConvertFromString ("Blue");
			MessageTextBox.FontFamily = new FontFamily ("Interstate");
			MessageTextBox.FontSize = m_MessageForm.Height / 15;
			MessageTextBox.FontWeight = FontWeights.Bold;
			MessageTextBox.BorderThickness = (Thickness) TIConverter.ConvertFromString ("0");
			MessageTextBox.IsReadOnly = true;
			m_MessageForm.Show ();
			return true;
			}
Exemplo n.º 7
0
 public void setTargetTextPadding(String padding)
 {
     ThicknessConverter thickCon = new ThicknessConverter();
     _canvasEl.Padding = (Thickness) thickCon.ConvertFromString(padding);
 }
Exemplo n.º 8
0
        private void CreateProjektForFaerbigeProjektKartenPage(FlowDocument ActuallDocument, DataRow ProjektRow,
            DataTable ConnectedActivities, DataTable Plakate, String PrintThisSecurityGroup,
            bool FullDataPresentationIsTrue, bool ShowDiskussionselemente, bool ShowPlakate = false)
            {
            BrushConverter BRConverter = new BrushConverter();
            ThicknessConverter ThickConverter = new ThicknessConverter();
            FontWeightConverter FWConverter = new FontWeightConverter();

            String ArbeitsGruppenNameID = ProjektRow["ArbeitsGruppenNameID"].ToString();
            String ArbeitsGruppenBeschreibung = String.Empty;
            foreach (DataRow AGRow in Basics.Instance.ArbeitsGruppen.Values)
                {
                if (AGRow["NameID"].ToString() == ArbeitsGruppenNameID)
                    {
                    ArbeitsGruppenBeschreibung = AGRow["LangName"].ToString();
                    break;
                    }
                }
            String Ortsteil = ProjektRow["Ortsteil"].ToString();
            String OrtsName = DataWrapper.Instance.GetOrteBezeichnung(ProjektRow);
            String NameID = ProjektRow["NameID"].ToString();
            String Wertigkeit = "Der Vorschlag hat keine Wertigkeitspunkte erhalten";
            if ((System.Guid) ProjektRow["ZustaendigID"] != System.Guid.Parse("EF0EFA6B-6884-4B54-9FDE-BCC575AE0D2A"))
                {
                Wertigkeit = "Für diesen Vorschlag ist nicht der "
                             +
                             Basics.Instance.Zustaendig["EF0EFA6B-6884-4B54-9FDE-BCC575AE0D2A".ToLower()]["NameID"]
                                 .ToString() +
                             " zuständig, sondern die Zuständigkeit ist \"" + ProjektRow["Zustaendig"].ToString() + "\"";
                }
            if ((ProjektRow["Wertigkeit"] != Convert.DBNull)
                && (Convert.ToInt32(ProjektRow["Wertigkeit"]) > 0))
                {
                Wertigkeit = "Das Projekt hat " + ProjektRow["Wertigkeit"].ToString() + " Wertigkeitspunkte erhalten";
                }
            String ProjektLangBeschreibung = ProjektRow["ProjektLangBeschreibung"].ToString();
            String NumericProjektID = ProjektRow["NumericProjektID"].ToString().Substring(3);
            String SymbolFarbe = GetSymbolColor(ConnectedActivities);

            //String Type = ProjektRow ["ProjektTyp"].ToString ();
            //String Wer = ProjektRow ["Wer"].ToString ();
            String OeffentlicheAktivitaetsInfo = GetOeffentlicheAktivitaetsInfo(ConnectedActivities);
//			ProjektRow ["TypenBeschreibung"].ToString ();


            Section ProjektSection = new Section();
            Paragraph NewPage = new Paragraph();
            NewPage.BreakPageBefore = true;
            ProjektSection.Blocks.Add(NewPage);
            ProjektSection.BreakPageBefore = true;
            ProjektSection.BorderThickness = (Thickness) ThickConverter.ConvertFromString("2");
            ProjektSection.BorderBrush = (Brush) BRConverter.ConvertFromString("Blue");
            ProjektSection.Tag = ProjektRow;

            TextPointer Start = ActuallDocument.ContentStart;
            Paragraph PArbeitsGruppenNameID = null;
            if (FullDataPresentationIsTrue)
                PArbeitsGruppenNameID = new Paragraph(new Run(ArbeitsGruppenNameID + " - " + ArbeitsGruppenBeschreibung
                                                              + "    (" + GetSortierFolge(ProjektRow) + ")"));
            else
                PArbeitsGruppenNameID = new Paragraph(new Run(ArbeitsGruppenNameID + " - " + ArbeitsGruppenBeschreibung
                                                              + "    (" + SymbolFarbe + " - " +
                                                              GetSortierFolge(ProjektRow) + ")"));
            PArbeitsGruppenNameID.FontSize = 14;
            PArbeitsGruppenNameID.BreakPageBefore = true;
            ProjektSection.Blocks.Add(PArbeitsGruppenNameID);

            List<String> BetreuerListe = WordUp23.DataWrapper.Instance.GetArbeitsGruppenMitarbeiter
                (ProjektRow, "8C2645EF-EED3-4169-8E63-DAE1F5CB55C6", (FullDataPresentationIsTrue == false)); // Betreuer
            Paragraph PArbeitsGruppenBetreuerHeadLine = new Paragraph(new Run("Verantwortliche Betreuer"));
            PArbeitsGruppenBetreuerHeadLine.FontSize = 8;
            PArbeitsGruppenBetreuerHeadLine.TextAlignment = TextAlignment.Right;
            ProjektSection.Blocks.Add(PArbeitsGruppenBetreuerHeadLine);
            foreach (String BetreuerDaten in BetreuerListe)
                {
                Paragraph PArbeitsGruppenBetreuer = new Paragraph(new Run(BetreuerDaten));
                PArbeitsGruppenBetreuer.FontSize = 10;
                PArbeitsGruppenBetreuer.TextAlignment = TextAlignment.Right;
                ProjektSection.Blocks.Add(PArbeitsGruppenBetreuer);
                }

            Paragraph PIntermediate1 = new Paragraph(new Run(""));
            PIntermediate1.FontSize = 10;
            PIntermediate1.Inlines.Add(new LineBreak());
            ProjektSection.Blocks.Add(PIntermediate1);

            Paragraph PProjektName = new Paragraph(new Run(Ortsteil + " - " + OrtsName + " - " + NameID));
            PProjektName.Inlines.Add(new LineBreak());
            PProjektName.FontSize = 18;
            PProjektName.FontWeight = (FontWeight) FWConverter.ConvertFromString("Bold");
            ProjektSection.Blocks.Add(PProjektName);

            Paragraph PProjektLangBeschreibung = new Paragraph(new Run(ProjektLangBeschreibung));
            //PProjektLangBeschreibung.Inlines.Add (new LineBreak ());
            PProjektLangBeschreibung.FontSize = 28;
            PProjektLangBeschreibung.TextAlignment = TextAlignment.Center;
            PProjektLangBeschreibung.FontWeight = (FontWeight) FWConverter.ConvertFromString("Bold");
            ProjektSection.Blocks.Add(PProjektLangBeschreibung);

            Paragraph PlakatHeadLineParagraph = new Paragraph();
            PlakatHeadLineParagraph.Inlines.Add(new LineBreak());
            PlakatHeadLineParagraph.Inlines.Add(new Run(Wertigkeit));
            PlakatHeadLineParagraph.Inlines.Add(new LineBreak());
            ActuallDocument.Blocks.Add(ProjektSection);

            if (ShowPlakate)
                {
                PlakatHeadLineParagraph.Inlines.Add(
                    new Run("Dieses/r Projekt/Vorschlag entstand aus folgenden Plakateinträgen:"));
                PlakatHeadLineParagraph.Inlines.Add(new LineBreak());
                PlakatHeadLineParagraph.FontSize = 12;
                ProjektSection.Blocks.Add(PlakatHeadLineParagraph);
                FlowDocumentBasis PlakatDoc = new FlowDocumentBasis();
                ActuallDocument.Blocks.Add(PlakatDoc.FillPlakateTable(String.Empty, String.Empty, Plakate));
                ActuallDocument.Blocks.LastBlock.Margin = new Thickness(30, 0, 0, 0);
                }
            Paragraph NewLineParagraph = new Paragraph(new Run(""));
            NewLineParagraph.FontSize = 10;
            NewLineParagraph.Inlines.Add(new LineBreak());
            ActuallDocument.Blocks.Add(NewLineParagraph);

            Paragraph OeffAktivitaet = new Paragraph(new Run(OeffentlicheAktivitaetsInfo));
            OeffAktivitaet.Inlines.Add(new LineBreak());
            ActuallDocument.Blocks.Add(OeffAktivitaet);

            FlowDocumentBasis AktivitaetDoc = new FlowDocumentBasis();
            ActuallDocument.Blocks.Add(AktivitaetDoc.FillActivitiesTable(PrintThisSecurityGroup, ConnectedActivities,
                new List<String>() {"FF793540-F928-4D38-BC42-0C61E9CCD649"}));
            ActuallDocument.Blocks.LastBlock.Margin = new Thickness(30, 0, 0, 10);


            Section FinalProjektSection = new Section();
            if (ShowDiskussionselemente)
                {
                String Line1 = "Soll weiter verfolgt werden ja / nein _________________________________________________";
                String Line2 =
                    "Wenn Begehung erforderlich - Treffpunkt / wann (Datum&Uhrzeit): ________________________";
                String Line3 = "Kontaktperson(en) bitte mit Name & HandyNummer: ___________________________________";
                //String MoeglicheBegehungsTermine = String.Join ("\r\n", GetMoeglicheBegehungen ().ToArray ());

                Paragraph PFormularTeil1 = new Paragraph(new LineBreak());
                PFormularTeil1.FontSize = 14;
                PFormularTeil1.Inlines.Add(new Run(Line1));
                PFormularTeil1.Inlines.Add(new LineBreak());
                PFormularTeil1.Inlines.Add(new LineBreak());
                FinalProjektSection.Blocks.Add(PFormularTeil1);
                Paragraph PFormularTeil2 = new Paragraph(new Run(Line2));
                PFormularTeil2.FontSize = 14;
                FinalProjektSection.Blocks.Add(PFormularTeil2);

                PFormularTeil2.Inlines.Add(new LineBreak());
                PFormularTeil2.Inlines.Add(new LineBreak());
                Paragraph PFormularTeil3 = new Paragraph(new Run(Line3));
                PFormularTeil3.FontSize = 14;
                PFormularTeil3.Inlines.Add(new LineBreak());
                PFormularTeil3.Inlines.Add(new LineBreak());
                FinalProjektSection.Blocks.Add(PFormularTeil3);

                Paragraph PVorschlagHeadLine = new Paragraph(new Run("Termin Möglichkeiten"));
                PVorschlagHeadLine.FontSize = 8;
                PVorschlagHeadLine.TextAlignment = TextAlignment.Right;
                PVorschlagHeadLine.Inlines.Add(new LineBreak());
                FinalProjektSection.Blocks.Add(PVorschlagHeadLine);

                foreach (String MoeglicherBegehungsTermin in GetMoeglicheBegehungen())
                    {
                    Paragraph PMoeglicherBegehungsTermin = new Paragraph(new Run(MoeglicherBegehungsTermin));
                    PMoeglicherBegehungsTermin.TextAlignment = TextAlignment.Right;
                    PMoeglicherBegehungsTermin.FontSize = 10;
                    FinalProjektSection.Blocks.Add(PMoeglicherBegehungsTermin);
                    }

                int PageLengthUpToNow = 0;
                TextPointer Stop = ActuallDocument.ContentEnd;
                PageLengthUpToNow = Start.GetOffsetToPosition(Stop);
                int LoopCounter = (1350 - PageLengthUpToNow)/90;
                while (LoopCounter-- > 0)
                    {
                    Paragraph PIntermediate3 = new Paragraph(new Run(""));
                    PIntermediate3.Inlines.Add(new LineBreak());
                    FinalProjektSection.Blocks.Add(PIntermediate3);
                    }
                }
            Paragraph PPageFooter = new Paragraph(new Run("Karte Nr.: " + GetSortierFolge(ProjektRow)
                                                          + ", Erzeugt am " +
                                                          DateTime.Now.ToString(WMB.Basics.ISO_DATE_TIME_FORMAT)));
            PPageFooter.FontSize = 10;
            PPageFooter.Inlines.Add(new LineBreak());
            PPageFooter.Inlines.Add(new LineBreak());
            PPageFooter.Inlines.Add(new LineBreak());
            PPageFooter.Inlines.Add(new LineBreak());
            PPageFooter.Inlines.Add(new Run("InsertPageBreakHere"));
            FinalProjektSection.Blocks.Add(PPageFooter);

            ActuallDocument.Blocks.Add(FinalProjektSection);

            //if (FullDataPresentationIsTrue)
            //    ProjektBlock.Blocks.Add (new PageBreak ())
            }
Exemplo n.º 9
0
		void InsertDataBlock (bool Compressed, String HeadLineText, DataTable Structure,
			DataTable ContentTable, DataRow Content, StackPanel Root)
			{
			if (Compressed)
				{
				InsertDataString (Compressed, HeadLineText, Structure,
									ContentTable, Content, Root);
				return;
				}
			GridLengthConverter GLConverter = new GridLengthConverter ();
			ThicknessConverter TConverter = new ThicknessConverter ();
			BrushConverter BConverter = new BrushConverter ();
			Grid BlockGrid = new Grid ();
			Root.Children.Add (BlockGrid);
			// HeadLine Row
			RowDefinition HeadLineRow = new RowDefinition ();
			HeadLineRow.Height = (GridLength)GLConverter.ConvertFromString ("*");
			BlockGrid.RowDefinitions.Add (HeadLineRow);
			// Content Rows
			foreach (DataColumn Column in Structure.Columns)
				{
				int NumberOfLines = GetNumberOfLines (Column);
				RowDefinition Row = new RowDefinition ();
				Row.Height = (GridLength)GLConverter.ConvertFromString (Convert.ToString (NumberOfLines) + "*");
				BlockGrid.RowDefinitions.Add (Row);
				}
			ColumnDefinition GroupNameColumn = new ColumnDefinition ();
			GroupNameColumn.Width = (GridLength)GLConverter.ConvertFromString ("*");
			BlockGrid.ColumnDefinitions.Add (GroupNameColumn);
			ColumnDefinition LabelNameColumn = new ColumnDefinition ();
			LabelNameColumn.Width = (GridLength)GLConverter.ConvertFromString ("5*");
			BlockGrid.ColumnDefinitions.Add (LabelNameColumn);
			ColumnDefinition ContentColumn = new ColumnDefinition ();
			ContentColumn.Width = (GridLength)GLConverter.ConvertFromString ("15*");
			BlockGrid.ColumnDefinitions.Add (ContentColumn);
			TextBlock GroupName = new TextBlock ();
			BlockGrid.Children.Add (GroupName);
			GroupName.Text = HeadLineText;
			Grid.SetColumn (GroupName, 0);
			Grid.SetRow (GroupName, 0);
			Grid.SetColumnSpan (GroupName, 2);
			int RowIndex = 1;
			int NumberOfAllLines = 0;
			double LineHeight = -1;
			foreach (DataColumn Column in Structure.Columns)
				{
				Label ColumnLabel = new Label ();
				BlockGrid.Children.Add (ColumnLabel);
				Grid.SetColumn (ColumnLabel, 1);
				Grid.SetRow (ColumnLabel, RowIndex);
				ColumnLabel.VerticalAlignment = VerticalAlignment.Top;
				if (String.IsNullOrEmpty (Column.Caption))
					ColumnLabel.Content = Column.ColumnName;
				else
					ColumnLabel.Content = Column.Caption;

				Border TextBlockBorder = new Border ();
				BlockGrid.Children.Add (TextBlockBorder);
				Grid.SetColumn (TextBlockBorder, 2);
				Grid.SetRow (TextBlockBorder, RowIndex);
				TextBlockBorder.BorderThickness = (Thickness)TConverter.ConvertFromString ("1");
				TextBlockBorder.BorderBrush = (Brush)BConverter.ConvertFromString ("Black");
				TextBox ColumnText = new TextBox ();
				TextBlockBorder.Child = ColumnText;
				ColumnText.TextWrapping = TextWrapping.Wrap;
				if (ContentTable.Columns [Column.ColumnName] != null)
					{
					ColumnText.Text = Content [Column.ColumnName].ToString ();
					}
				RowIndex++;
				}
			}
Exemplo n.º 10
0
		void InsertDataString (bool Compressed, String HeadLineText, DataTable Structure,
									DataTable ContentTable, DataRow Content, StackPanel Root)
			{
			GridLengthConverter GLConverter = new GridLengthConverter ();
			ThicknessConverter TConverter = new ThicknessConverter ();
			BrushConverter BConverter = new BrushConverter ();

			String Text = "";
			foreach (DataColumn Column in Structure.Columns)
				{
				if (ContentTable.Columns [Column.ColumnName] != null)
					{
					DataColumn Col = ContentTable.Columns [Column.ColumnName];
					if (Col.DataType.Name == "Guid")
						continue;
					if (!String.IsNullOrEmpty (Content [Column.ColumnName].ToString ()))
						if (String.IsNullOrEmpty (Text))
							Text = Content [Column.ColumnName].ToString ();
						else
							Text += "; " + Content [Column.ColumnName].ToString ();
					}
				}

	
			Grid BlockGrid = new Grid ();
			Root.Children.Add (BlockGrid);
			// HeadLine Row
			RowDefinition HeadLineRow = new RowDefinition ();
			HeadLineRow.Height = (GridLength)GLConverter.ConvertFromString ("*");
			BlockGrid.RowDefinitions.Add (HeadLineRow);
			RowDefinition ContentLineRow = new RowDefinition ();
			ContentLineRow.Height = (GridLength)GLConverter.ConvertFromString 
				(Convert.ToString (((int)(Text.Length / 50)) + 1) + "*");
			BlockGrid.RowDefinitions.Add (ContentLineRow);
			ColumnDefinition GroupNameColumn = new ColumnDefinition ();
			GroupNameColumn.Width = (GridLength)GLConverter.ConvertFromString ("*");
			BlockGrid.ColumnDefinitions.Add (GroupNameColumn);
			ColumnDefinition ContentColumn = new ColumnDefinition ();
			ContentColumn.Width = (GridLength)GLConverter.ConvertFromString ("12*");
			BlockGrid.ColumnDefinitions.Add (ContentColumn);
			TextBlock GroupName = new TextBlock ();
			BlockGrid.Children.Add (GroupName);
			GroupName.Text = HeadLineText;
			Grid.SetColumn (GroupName, 0);
			Grid.SetRow (GroupName, 0);
			Grid.SetColumnSpan (GroupName, 2);
			Border TextBlockBorder = new Border ();
			BlockGrid.Children.Add (TextBlockBorder);
			Grid.SetColumn (TextBlockBorder, 2);
			Grid.SetRow (TextBlockBorder, 1);
			TextBlockBorder.BorderThickness = (Thickness)TConverter.ConvertFromString ("1");
			TextBlockBorder.BorderBrush = (Brush)BConverter.ConvertFromString ("Black");
			TextBox ColumnText = new TextBox ();
			TextBlockBorder.Child = ColumnText;
			ColumnText.TextWrapping = TextWrapping.Wrap;
			ColumnText.Text = Text;
			}
Exemplo n.º 11
0
		private double CreateFieldDefinitions (Grid ButtonGrid)
			{
			GridLengthConverter GLConverter = new GridLengthConverter ();
			ThicknessConverter TConverter = new ThicknessConverter ();
			BrushConverter BConverter = new BrushConverter ();
			int RowIndex = 0;
			int NumberOfAllLines = 0;
			double LineHeight = -1;
			foreach (DataColumn Column in m_RowToProcess.Table.Columns)
				{
				int NumberOfLines = GetNumberOfLines (Column);
				Label ColumnLabel = new Label ();
				ButtonGrid.Children.Add (ColumnLabel);
				Grid.SetColumn (ColumnLabel, 0);
				Grid.SetRow (ColumnLabel, RowIndex);
				ColumnLabel.VerticalAlignment = VerticalAlignment.Top;
				if (String.IsNullOrEmpty (Column.Caption))
					ColumnLabel.Content = Column.ColumnName;
				else
					ColumnLabel.Content = Column.Caption;
				if (LineHeight == -1)
					{
					ColumnLabel.UpdateLayout ();
					LineHeight = ColumnLabel.DesiredSize.Height;
					}
				Border TextBlockBorder = new Border ();
				ButtonGrid.Children.Add (TextBlockBorder);
				Grid.SetColumn (TextBlockBorder, 1);
				Grid.SetRow (TextBlockBorder, RowIndex);
				TextBlockBorder.BorderThickness = (Thickness)TConverter.ConvertFromString ("1");
				TextBlockBorder.BorderBrush = (Brush)BConverter.ConvertFromString ("Black");
				TextBox ColumnText = new TextBox ();
				TextBlockBorder.Child = ColumnText;
				ColumnText.TextWrapping = TextWrapping.Wrap;
				CVM.CommonValues.SelectionDefinition SpecialFieldProcessing =
						GetSelectionDefinition (m_RowToProcess.Table.TableName, Column.ColumnName);
				if (String.IsNullOrEmpty (SpecialFieldProcessing.m_TableName))
					{
					ColumnText.Text = m_RowToProcess [Column.ColumnName].ToString ();
					Grid.SetColumnSpan (TextBlockBorder, 2);
					}
				else
					{
					if ((m_UpdateAllowed == true)
						&& (SpecialFieldProcessing.m_UpdateAble == true))
						{
						Grid.SetColumnSpan (TextBlockBorder, 1);
						Button OpenSelection = new Button ();
						OpenSelection.Content = "....";
						Grid.SetColumn (OpenSelection, 2);
						Grid.SetRow (OpenSelection, RowIndex);
						OpenSelection.IsEnabled = true;
						OpenSelection.Tag = SpecialFieldProcessing;
						OpenSelection.Click += new RoutedEventHandler (OpenSelection_Click);
						ButtonGrid.Children.Add (OpenSelection);
						}
					if (GetReadableTextForEntryCall == null)
						ColumnText.Text = "Fehler - GetReadableTextForEntryCall not defined";
					else
						ColumnText.Text = GetReadableTextForEntryCall
							(this, SpecialFieldProcessing.m_ForeignTableName, m_RowToProcess [Column.ColumnName].ToString ());
					}
				ColumnText.Height = NumberOfLines * LineHeight;

				if ((m_UpdateAllowed == true)
					&& (m_PrimaryKeyName != Column.ColumnName))
					{
					ColumnText.IsEnabled = true;
					ColumnText.Tag = Column.ColumnName;
					m_UpdateableControls.Add (ColumnText);
					}
				else
					{
					ColumnText.IsEnabled = false;
					}
				NumberOfAllLines += NumberOfLines;
				RowIndex++;
				}
			return (double) ((NumberOfAllLines + 2) * LineHeight) + (NumberOfAllLines * 2);
			}
Exemplo n.º 12
0
        private double CreateFieldDefinitions (Grid ButtonGrid, Grid ContentGrid)
            {
            GridLengthConverter GLConverter = new GridLengthConverter ();
            ThicknessConverter TConverter = new ThicknessConverter ();
            BrushConverter BConverter = new BrushConverter ();
            RowDefinition ButtonRow = new RowDefinition ();
            ButtonRow.Height = (GridLength)GLConverter.ConvertFromString ("20");
            RowDefinition ContentRow = new RowDefinition ();
            ContentRow.Height = (GridLength)GLConverter.ConvertFromString ("*");
            RootGrid.RowDefinitions.Add (ButtonRow);
            RootGrid.RowDefinitions.Add (ContentRow);

            RootGrid.Children.Add (ButtonGrid);
            Grid.SetRow (ButtonGrid, 0);
            Grid.SetColumn (ButtonGrid, 1);

            ScrollViewer ScrollArea = new ScrollViewer ();
            RootGrid.Children.Add (ScrollArea);
            Grid.SetRow (ScrollArea, 1);
            Grid.SetColumn (ScrollArea, 0);
            Grid.SetColumnSpan (ScrollArea, 3);
            ScrollArea.Content = ContentGrid;

            int RowIndex = 0;
            int NumberOfAllLines = 0;
            double LineHeight = -1;
            WMB.TableContentDefinition SpecialFieldProcessing;
            foreach (DataColumn Column in m_RowToProcess.Table.Columns)
                {
                if (IsSkipingColumns (Column.ColumnName))
                    continue;
                SpecialFieldProcessing = DataBase.GetColumnDefinition 
                    (m_RowToProcess.Table.TableName, Column.ColumnName, true);
                Label ColumnLabel = new Label ();
                ColumnLabel.FontSize *= 1.3;
                if (!String.IsNullOrEmpty (SpecialFieldProcessing.m_ToolTip))
                    ColumnLabel.ToolTip = SpecialFieldProcessing.m_ToolTip;
                ContentGrid.Children.Add (ColumnLabel);
                Grid.SetColumn (ColumnLabel, 0);
                Grid.SetRow (ColumnLabel, RowIndex);
                ColumnLabel.VerticalAlignment = VerticalAlignment.Top;
                if (!String.IsNullOrEmpty (SpecialFieldProcessing.m_ReadableName))
                    Column.Caption = SpecialFieldProcessing.m_ReadableName;
                if (String.IsNullOrEmpty (Column.Caption))
                    ColumnLabel.Content = Column.ColumnName;
                else
                    ColumnLabel.Content = Column.Caption;
                if (LineHeight == -1)
                    {
                    ColumnLabel.UpdateLayout ();
                    LineHeight = ColumnLabel.DesiredSize.Height;
                    }
                if (!String.IsNullOrEmpty (SpecialFieldProcessing.m_Help))
                    {
                    ColumnLabel.Tag = SpecialFieldProcessing.m_Help;
                    ColumnLabel.MouseRightButtonUp += new MouseButtonEventHandler (ColumnLabel_MouseRightButtonUp);
                    }

                int NumberOfLines = GetNumberOfLines (m_RowToProcess, Column);
                Border TextBlockBorder = new Border ();
                ContentGrid.Children.Add (TextBlockBorder);
                Grid.SetColumn (TextBlockBorder, 1);
                Grid.SetRow (TextBlockBorder, RowIndex);
                TextBlockBorder.BorderThickness = (Thickness)TConverter.ConvertFromString ("1");
                TextBlockBorder.BorderBrush = (Brush)BConverter.ConvertFromString ("Black");
                TextBox ColumnText = new TextBox ();
                ColumnText.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
                ColumnText.AcceptsReturn = true;
                TextBlockBorder.Child = ColumnText;
                ColumnText.TextWrapping = TextWrapping.Wrap;
                if ((m_UpdateAllowed == true)
                    && (m_PrimaryKeyName != Column.ColumnName))
                    {
                    ColumnText.IsEnabled = true;
                    ColumnText.Tag = Column.ColumnName;
                    m_UpdateableControls.Add (ColumnText);
                    }
                else
                    {
                    ColumnText.IsEnabled = false;
                    }
                if (((String.IsNullOrEmpty (SpecialFieldProcessing.m_TableName))
                     && (SpecialFieldProcessing.m_DefaultContentRules == null))
                    || (SpecialFieldProcessing.m_TypeOfSpecialFieldProcessing
                        == WMB.TableContentDefinition.SQL_COLUMN_PROPERTY_CONNECTED_VALUE))
                    {
                    ColumnText.Text = m_RowToProcess [Column.ColumnName].ToString ();
                    Grid.SetColumnSpan (TextBlockBorder, 2);
                    }
                else
                    {
                    if ((m_UpdateAllowed == true)
                        && (SpecialFieldProcessing.m_UpdateAble == true))
                        {
                        Grid.SetColumnSpan (TextBlockBorder, 1);
                        Button OpenSelection = new Button ();
                        OpenSelection.Content = "....";
                        Grid.SetColumn (OpenSelection, 2);
                        Grid.SetRow (OpenSelection, RowIndex);
                        OpenSelection.IsEnabled = true;
                        OpenSelection.Tag = SpecialFieldProcessing;
                        OpenSelection.Click += new RoutedEventHandler (OpenSelection_Click);
                        ContentGrid.Children.Add (OpenSelection);
                        }
                    if (GetReadableTextForEntryCall == null)
                        ColumnText.Text = "Fehler - GetReadableTextForEntryCall not defined";
                    else
                        {
                        if (SpecialFieldProcessing.m_TypeOfSpecialFieldProcessing
                            == WMB.TableContentDefinition.SQL_COLUMN_PROPERTY_CONNECTOR_ID)
                            {
                            ColumnText.Text = GetReadableTextForEntryCall
                                (this, SpecialFieldProcessing.m_ForeignTableName,
                                    m_RowToProcess [Column.ColumnName].ToString ());
                            }
                        else
                            {
                            ColumnText.Text = m_RowToProcess [Column.ColumnName].ToString ();
                            }
                        ColumnText.IsReadOnly = true;
                        ColumnText.IsEnabled = false;
                        }
                    }
                //ColumnText.Height = NumberOfLines * LineHeight;

                NumberOfAllLines += NumberOfLines;
                RowIndex++;
                }
            return (double)((NumberOfAllLines + 2) * LineHeight) + (NumberOfAllLines * 2);
            }