public ValueCopyDesignerControl()
        {
            Grid LayoutRoot = new Grid();

            LayoutRoot.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            LayoutRoot.RowDefinitions.Add(new RowDefinition());

            // ТУЛБАР
            m_ToolBar        = new RanetToolBar();
            m_ToolBar.Margin = new Thickness(0, 0, 0, 4);
            LayoutRoot.Children.Add(m_ToolBar);
            Grid.SetRow(m_ToolBar, 0);

            // Контрол копирования данных
            m_CopyControl             = new ValueCopyControl();
            m_CopyControl.IsAdminMode = true;
            LayoutRoot.Children.Add(m_CopyControl);
            Grid.SetRow(m_CopyControl, 1);

            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);

            m_ToolBar.AddItem(new RanetToolBarSplitter());

            RanetToolBarButton m_PreviewButton = new RanetToolBarButton();

            m_PreviewButton.Content = UiHelper.CreateIcon(UriResources.Images.Run16);
            m_PreviewButton.Click  += new RoutedEventHandler(m_PreviewButton_Click);
            ToolTipService.SetToolTip(m_PreviewButton, Localization.ValueCopyControl_RunCopyForm_Tooltip);
            m_ToolBar.AddItem(m_PreviewButton);

            m_OlapDataLoader = GetOlapDataLoader();
            m_StorageManager = GetStorageManager();

            m_StorageManager.InvokeCompleted += new EventHandler <DataLoaderEventArgs>(StorageManager_ActionCompleted);
            m_OlapDataLoader.DataLoaded      += new EventHandler <DataLoaderEventArgs>(OlapDataLoader_DataLoaded);

            grdIsWaiting = new Grid()
            {
                Background = new SolidColorBrush(Color.FromArgb(125, 0xFF, 0xFF, 0xFF))
            };
            grdIsWaiting.Visibility = Visibility.Collapsed;
            BusyControl m_Waiting = new BusyControl();

            m_Waiting.Text = Localization.Loading;
            grdIsWaiting.Children.Add(m_Waiting);

            LayoutRoot.Children.Add(grdIsWaiting);
            Grid.SetColumnSpan(grdIsWaiting, LayoutRoot.ColumnDefinitions.Count > 0 ? LayoutRoot.ColumnDefinitions.Count : 1);
            Grid.SetRowSpan(grdIsWaiting, LayoutRoot.RowDefinitions.Count > 0 ? LayoutRoot.RowDefinitions.Count : 1);

            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;
        }
Beispiel #3
0
        public ObjectsListControlBase()
        {
            Grid LayoutRoot = new Grid();

            LayoutRoot.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            LayoutRoot.RowDefinitions.Add(new RowDefinition());

            ToolBar = new RanetToolBar();
            LayoutRoot.Children.Add(ToolBar);

            AddButton         = new RanetToolBarButton();
            AddButton.Content = UiHelper.CreateIcon(UriResources.Images.New16);
            AddButton.Click  += new RoutedEventHandler(m_AddButton_Click);
            ToolTipService.SetToolTip(AddButton, Localization.Toolbar_NewButton_ToolTip);
            ToolBar.AddItem(AddButton);

            DeleteButton           = new RanetToolBarButton();
            DeleteButton.Content   = UiHelper.CreateIcon(UriResources.Images.RemoveCross16);
            DeleteButton.Click    += new RoutedEventHandler(m_DeleteButton_Click);
            DeleteButton.IsEnabled = false;
            ToolTipService.SetToolTip(DeleteButton, Localization.Toolbar_DeleteButton_ToolTip);
            ToolBar.AddItem(DeleteButton);
            DeleteButton.IsEnabledChanged += new DependencyPropertyChangedEventHandler(OnDeleteButton_IsEnabledChanged);

            DeleteAllButton           = new RanetToolBarButton();
            DeleteAllButton.Content   = UiHelper.CreateIcon(UriResources.Images.RemoveAllCross16);
            DeleteAllButton.Click    += new RoutedEventHandler(m_DeleteAllButton_Click);
            DeleteAllButton.IsEnabled = false;
            ToolTipService.SetToolTip(DeleteAllButton, Localization.Toolbar_DeleteAllButton_ToolTip);
            ToolBar.AddItem(DeleteAllButton);
            DeleteAllButton.IsEnabledChanged += new DependencyPropertyChangedEventHandler(OnDeleteAllButton_IsEnabledChanged);

            Tree = new CustomTree()
            {
                BorderBrush = new SolidColorBrush(Colors.DarkGray)
            };
            Tree.SelectedItemChanged += new RoutedPropertyChangedEventHandler <object>(m_Tree_SelectedItemChanged);
            LayoutRoot.Children.Add(Tree);
            Grid.SetRow(Tree, 1);

            grdIsWaiting = new Grid()
            {
                Background = new SolidColorBrush(Color.FromArgb(125, 0xFF, 0xFF, 0xFF))
            };
            grdIsWaiting.Visibility = Visibility.Collapsed;
            BusyControl m_Waiting = new BusyControl();

            m_Waiting.Text = Localization.Loading;
            grdIsWaiting.Children.Add(m_Waiting);
            LayoutRoot.Children.Add(grdIsWaiting);
            Grid.SetColumnSpan(grdIsWaiting, LayoutRoot.ColumnDefinitions.Count > 0 ? LayoutRoot.ColumnDefinitions.Count : 1);
            Grid.SetRowSpan(grdIsWaiting, LayoutRoot.RowDefinitions.Count > 0 ? LayoutRoot.RowDefinitions.Count : 1);

            this.Content = LayoutRoot;

            this.Loaded  += new RoutedEventHandler(ObjectsListControlBase_Loaded);
            Tree.KeyDown += new KeyEventHandler(m_Tree_KeyDown);
        }