public ValueCopyControl() { Grid LayoutRoot = new Grid(); LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); LayoutRoot.RowDefinitions.Add(new RowDefinition()); Grid Row0_LayoutRoot = new Grid(); Row0_LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); Row0_LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); Row0_LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); Row0_LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); Row0_LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition()); Row0_LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition()); //Row0_LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); // Тип копирования TextBlock Label_CopyType = new TextBlock() { Text = Localization.ValueCopyControl_TypeOfCopying, Margin = new Thickness(0) }; Row0_LayoutRoot.Children.Add(Label_CopyType); Grid.SetRow(Label_CopyType, 0); Grid.SetColumnSpan(Label_CopyType, 2); m_CopyType = new ComboBoxEx(); m_CopyType.Margin = new Thickness(0, 5, 0, 0); ItemControlBase ctrl; ctrl = new ItemControlBase(false); ctrl.Text = Localization.ValueCopyControl_CopyValueFromSource; ctrl.Tag = ValueCopyTypes.CopyValueFromSource; m_CopyType.Combo.Items.Add(ctrl); ctrl = new ItemControlBase(false); ctrl.Text = Localization.ValueCopyControl_DeliveryValuePropotrionalSource; ctrl.Tag = ValueCopyTypes.DeliveryValuePropotrionalSource; m_CopyType.Combo.Items.Add(ctrl); Row0_LayoutRoot.Children.Add(m_CopyType); Grid.SetRow(m_CopyType, 1); Grid.SetColumnSpan(m_CopyType, 2); // Коэффициент TextBlock Label_Coefficient = new TextBlock() { Text = Localization.ValueCopyControl_Сoefficient, Margin = new Thickness(0, 5, 0, 0) }; Row0_LayoutRoot.Children.Add(Label_Coefficient); Grid.SetRow(Label_Coefficient, 2); m_Coefficient = new RichTextBox() { Text = "1", Margin = new Thickness(0, 5, 0, 0) }; Row0_LayoutRoot.Children.Add(m_Coefficient); Grid.SetRow(m_Coefficient, 3); // Значение TextBlock Label_Value = new TextBlock() { Text = Localization.ValueCopyControl_Value, Margin = new Thickness(5, 5, 0, 0) }; Row0_LayoutRoot.Children.Add(Label_Value); Grid.SetRow(Label_Value, 2); Grid.SetColumn(Label_Value, 1); m_Value = new RichTextBox() { Text = "0", Margin = new Thickness(5, 5, 0, 0) }; Row0_LayoutRoot.Children.Add(m_Value); Grid.SetRow(m_Value, 3); Grid.SetColumn(m_Value, 1); m_CopyType.SelectionChanged += new SelectionChangedEventHandler(m_CopyType_SelectionChanged); m_CopyType.Combo.SelectedIndex = 0; LayoutRoot.Children.Add(Row0_LayoutRoot); Grid.SetRow(Row0_LayoutRoot, 1); Grid Row1_LayoutRoot = new Grid(); Row1_LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); Row1_LayoutRoot.RowDefinitions.Add(new RowDefinition()); // Координаты TextBlock Label_Coordinates = new TextBlock() { Text = Localization.ValueCopyControl_Coordinates, Margin = new Thickness(0, 5, 0, 0) }; Row1_LayoutRoot.Children.Add(Label_Coordinates); Grid.SetRow(Label_Coordinates, 0); m_Coordinates = new CoordinatesControl(); m_Coordinates.GetOlapDataLoader += new EventHandler <GetIDataLoaderArgs>(m_Coordinates_GetOlapDataLoader); m_Coordinates.Margin = new Thickness(5); Border coordinates_Border = new Border() { Margin = new Thickness(0, 5, 0, 0), BorderBrush = new SolidColorBrush(Colors.DarkGray), BorderThickness = new Thickness(1) }; coordinates_Border.Child = m_Coordinates; Row1_LayoutRoot.Children.Add(coordinates_Border); Grid.SetRow(coordinates_Border, 1); LayoutRoot.Children.Add(Row1_LayoutRoot); Grid.SetRow(Row1_LayoutRoot, 2); // Ожидание загрузки m_Waiting = new BusyControl(); m_Waiting.Text = Localization.Loading; Row1_LayoutRoot.Children.Add(m_Waiting); Grid.SetRow(m_Waiting, 2); // ТУЛБАР m_ToolBar = new RanetToolBar(); m_ToolBar.Margin = new Thickness(0, 0, 0, 4); LayoutRoot.Children.Add(m_ToolBar); Grid.SetRow(m_ToolBar, 0); UseToolbar = false; RanetToolBarButton m_ImportLayout = new RanetToolBarButton(); m_ImportLayout.Content = UiHelper.CreateIcon(UriResources.Images.FileImport16); m_ImportLayout.Click += new RoutedEventHandler(m_ImportLayout_Click); ToolTipService.SetToolTip(m_ImportLayout, Localization.ValueCopyControl_ImportSettings_ToolTip); m_ToolBar.AddItem(m_ImportLayout); RanetToolBarButton m_ExportLayout = new RanetToolBarButton(); m_ExportLayout.Content = UiHelper.CreateIcon(UriResources.Images.FileExport16); m_ExportLayout.Click += new RoutedEventHandler(m_ExportLayout_Click); ToolTipService.SetToolTip(m_ExportLayout, Localization.ValueCopyControl_ExportSettings_ToolTip); m_ToolBar.AddItem(m_ExportLayout); IsBusy = false; this.Content = LayoutRoot; }
public ValueCopyControl() { Grid LayoutRoot = new Grid(); LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); LayoutRoot.RowDefinitions.Add(new RowDefinition()); Grid Row0_LayoutRoot = new Grid(); Row0_LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); Row0_LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); Row0_LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); Row0_LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); Row0_LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition()); Row0_LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition()); //Row0_LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); // Тип копирования TextBlock Label_CopyType = new TextBlock() { Text = Localization.ValueCopyControl_TypeOfCopying, Margin = new Thickness(0) }; Row0_LayoutRoot.Children.Add(Label_CopyType); Grid.SetRow(Label_CopyType, 0); Grid.SetColumnSpan(Label_CopyType, 2); m_CopyType = new ComboBoxEx(); m_CopyType.Margin = new Thickness(0, 5, 0, 0); ItemControlBase ctrl; ctrl = new ItemControlBase(false); ctrl.Text = Localization.ValueCopyControl_CopyValueFromSource; ctrl.Tag = ValueCopyTypes.CopyValueFromSource; m_CopyType.Combo.Items.Add(ctrl); ctrl = new ItemControlBase(false); ctrl.Text = Localization.ValueCopyControl_DeliveryValuePropotrionalSource; ctrl.Tag = ValueCopyTypes.DeliveryValuePropotrionalSource; m_CopyType.Combo.Items.Add(ctrl); Row0_LayoutRoot.Children.Add(m_CopyType); Grid.SetRow(m_CopyType, 1); Grid.SetColumnSpan(m_CopyType, 2); // Коэффициент TextBlock Label_Coefficient = new TextBlock() { Text = Localization.ValueCopyControl_Сoefficient, Margin = new Thickness(0, 5, 0, 0) }; Row0_LayoutRoot.Children.Add(Label_Coefficient); Grid.SetRow(Label_Coefficient, 2); m_Coefficient = new RichTextBox() { Text = "1", Margin = new Thickness(0, 5, 0, 0) }; Row0_LayoutRoot.Children.Add(m_Coefficient); Grid.SetRow(m_Coefficient, 3); // Значение TextBlock Label_Value = new TextBlock() { Text = Localization.ValueCopyControl_Value, Margin = new Thickness(5, 5, 0, 0) }; Row0_LayoutRoot.Children.Add(Label_Value); Grid.SetRow(Label_Value, 2); Grid.SetColumn(Label_Value, 1); m_Value = new RichTextBox() { Text = "0", Margin = new Thickness(5, 5, 0, 0) }; Row0_LayoutRoot.Children.Add(m_Value); Grid.SetRow(m_Value, 3); Grid.SetColumn(m_Value, 1); m_CopyType.SelectionChanged += new SelectionChangedEventHandler(m_CopyType_SelectionChanged); m_CopyType.Combo.SelectedIndex = 0; LayoutRoot.Children.Add(Row0_LayoutRoot); Grid.SetRow(Row0_LayoutRoot, 1); Grid Row1_LayoutRoot = new Grid(); Row1_LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); Row1_LayoutRoot.RowDefinitions.Add(new RowDefinition()); // Координаты TextBlock Label_Coordinates = new TextBlock() { Text = Localization.ValueCopyControl_Coordinates, Margin = new Thickness(0, 5, 0, 0) }; Row1_LayoutRoot.Children.Add(Label_Coordinates); Grid.SetRow(Label_Coordinates, 0); m_Coordinates = new CoordinatesControl(); m_Coordinates.GetOlapDataLoader += new EventHandler<GetIDataLoaderArgs>(m_Coordinates_GetOlapDataLoader); m_Coordinates.Margin = new Thickness(5); Border coordinates_Border = new Border() { Margin = new Thickness(0,5,0,0), BorderBrush = new SolidColorBrush(Colors.DarkGray), BorderThickness = new Thickness(1) }; coordinates_Border.Child = m_Coordinates; Row1_LayoutRoot.Children.Add(coordinates_Border); Grid.SetRow(coordinates_Border, 1); LayoutRoot.Children.Add(Row1_LayoutRoot); Grid.SetRow(Row1_LayoutRoot, 2); // Ожидание загрузки m_Waiting = new BusyControl(); m_Waiting.Text = Localization.Loading; Row1_LayoutRoot.Children.Add(m_Waiting); Grid.SetRow(m_Waiting, 2); // ТУЛБАР m_ToolBar = new RanetToolBar(); m_ToolBar.Margin = new Thickness(0, 0, 0, 4); LayoutRoot.Children.Add(m_ToolBar); Grid.SetRow(m_ToolBar, 0); UseToolbar = false; RanetToolBarButton m_ImportLayout = new RanetToolBarButton(); m_ImportLayout.Content = UiHelper.CreateIcon(UriResources.Images.FileImport16); m_ImportLayout.Click += new RoutedEventHandler(m_ImportLayout_Click); ToolTipService.SetToolTip(m_ImportLayout, Localization.ValueCopyControl_ImportSettings_ToolTip); m_ToolBar.AddItem(m_ImportLayout); RanetToolBarButton m_ExportLayout = new RanetToolBarButton(); m_ExportLayout.Content = UiHelper.CreateIcon(UriResources.Images.FileExport16); m_ExportLayout.Click += new RoutedEventHandler(m_ExportLayout_Click); ToolTipService.SetToolTip(m_ExportLayout, Localization.ValueCopyControl_ExportSettings_ToolTip); m_ToolBar.AddItem(m_ExportLayout); IsBusy = false; this.Content = LayoutRoot; }