public DateChoiceCtrl()
        {
            Grid LayoutRoot = new Grid();
            m_Calendar = new System.Windows.Controls.Calendar();
            m_Calendar.SelectionMode = CalendarSelectionMode.SingleDate;
            m_Calendar.DisplayDate = DateTime.Today;
            m_Calendar.DisplayDateChanged += new EventHandler<CalendarDateChangedEventArgs>(m_Calendar_DisplayDateChanged);
            m_Calendar.SelectedDatesChanged += new EventHandler<SelectionChangedEventArgs>(m_Calendar_SelectedDatesChanged);
            
            LayoutRoot.Children.Add(m_Calendar);

            m_Waiting = new BusyControl();
            m_Waiting.Text = Localization.Loading;
            LayoutRoot.Children.Add(m_Waiting);
            Grid.SetRow(m_Waiting, 1);

            IsBusy = false;

            this.Content = LayoutRoot;

            resDoubleClickTimer = new Storyboard();
            resDoubleClickTimer.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 250));
            resDoubleClickTimer.Completed += new EventHandler(Storyboard_Completed);
            LayoutRoot.Resources.Add("resDoubleClickTimer", resDoubleClickTimer);

            m_Calendar.MouseLeftButtonDown += new MouseButtonEventHandler(Calendar_MouseLeftButtonDown);
        }
        public DatePickerEx()
        {
            m_Waiting = new BusyControl();
            m_Waiting.Text = Localization.Loading;

            this.Loaded += new RoutedEventHandler(DatePickerEx_Loaded);
        }
        public KpiViewer()
        {            
            ScrollViewer Scroll = new ScrollViewer();
            Scroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            Scroll.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            m_DataGrid = new DragDropDataGrid();
            m_DataGrid.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            m_DataGrid.VerticalAlignment = VerticalAlignment.Top;
            LayoutRoot = new Grid();
            LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            LayoutRoot.RowDefinitions.Add(new RowDefinition());
            m_InputColumn = new ColumnDefinition() { Width = new GridLength(m_InputColumnWidth) };
            LayoutRoot.ColumnDefinitions.Add(m_InputColumn);
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() { /*Width = new GridLength(2, GridUnitType.Star)*/ });

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

            m_ShowMetadataArea = new RanetToggleButton();
            m_ShowMetadataArea.ClickMode = ClickMode.Press;            
            m_ShowMetadataArea.IsChecked = true;
            m_ShowMetadataArea.Checked += new RoutedEventHandler(m_ShowMetadataArea_Checked);
            m_ShowMetadataArea.Unchecked += new RoutedEventHandler(m_ShowMetadataArea_Unchecked);
            m_ShowMetadataArea.Content = UiHelper.CreateIcon(UriResources.Images.Menu16);
            ToolTipService.SetToolTip(m_ShowMetadataArea, Localization.MdxDesigner_ShowQueryDesigner_ToolTip);
            m_ToolBar.AddItem(m_ShowMetadataArea);

            RanetToggleButton showAllButton = new RanetToggleButton();
            showAllButton.ClickMode = ClickMode.Press;
            showAllButton.Content = UiHelper.CreateIcon(UriResources.GetImage("/Ranet.AgOlap;component/Controls/Images/OLAP/KPI/ShowAll.png"));
            showAllButton.Checked += new RoutedEventHandler(showAllButton_Checked);
            showAllButton.Unchecked += new RoutedEventHandler(showAllButton_Unchecked);
            ToolTipService.SetToolTip(showAllButton,Localization.ShowAll_Check);
            showAllButton.Visibility = System.Windows.Visibility.Collapsed;
            m_ToolBar.AddItem(showAllButton);

            RanetToolBarButton m_ApplyChanges = new RanetToolBarButton();
            m_ApplyChanges.ClickMode = ClickMode.Press;
            m_ApplyChanges.Click += new RoutedEventHandler(m_ApplyChanges_Click);
            m_ApplyChanges.Content = UiHelper.CreateIcon(UriResources.Images.Run16);
            ToolTipService.SetToolTip(m_ApplyChanges, Localization.Apply);
            m_ToolBar.AddItem(m_ApplyChanges);

            //showColumnChoice = new RanetToggleButton();
            //showColumnChoice.ClickMode = ClickMode.Press;
            //showColumnChoice.IsChecked = true;
            //showColumnChoice.Checked += new RoutedEventHandler(showColumnChoice_Checked);
            //showColumnChoice.Unchecked += new RoutedEventHandler(showColumnChoice_Unchecked);
            //showColumnChoice.Content = UiHelper.CreateIcon(UriResources.Images.ColumnsArea16);
            //ToolTipService.SetToolTip(showColumnChoice, Localization.MdxDesigner_RunQueryAutomatic);
            //this.m_ToolBar.AddItem(showColumnChoice);  
                     
            Grid Input_LayoutRoot = new Grid();
            Input_LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(2, GridUnitType.Star) });
            Input_LayoutRoot.Margin = new Thickness(0, 0, 0, 0);
            Input_LayoutRoot.RowDefinitions.Add(new RowDefinition());

            
            Input_Border = new Border() { Padding = new Thickness(3), BorderBrush = new SolidColorBrush(Colors.DarkGray), BorderThickness = new Thickness(1) };
            Input_Border.Margin = new Thickness(0, 0, 5, 0);
            Input_Border.Child = Input_LayoutRoot;

            Grid Ouput_LayoutRoot = new Grid();
            Ouput_LayoutRoot.Margin = new Thickness(0, 0, 0, 0);
            // По умолчанию высота 0
            var m_MDX_Row = new RowDefinition() { Height = new GridLength(0.0) };
            Ouput_LayoutRoot.RowDefinitions.Add(m_MDX_Row);
            Ouput_LayoutRoot.RowDefinitions.Add(new RowDefinition() /*{ Height = new GridLength(2, GridUnitType.Star) }*/);

            LayoutRoot.Children.Add(Input_Border);
            Grid.SetRow(Input_Border, 1);
            LayoutRoot.Children.Add(Ouput_LayoutRoot);
            Grid.SetRow(Ouput_LayoutRoot, 1);
            Grid.SetColumn(Ouput_LayoutRoot, 1);

            LayoutRoot_VertSplitter = new RanetGridSplitter();
            LayoutRoot_VertSplitter.VerticalAlignment = VerticalAlignment.Stretch;
            LayoutRoot_VertSplitter.HorizontalAlignment = HorizontalAlignment.Right;
            LayoutRoot_VertSplitter.IsTabStop = false;
            LayoutRoot_VertSplitter.Background = new SolidColorBrush(Colors.Transparent);
            LayoutRoot.Children.Add(LayoutRoot_VertSplitter);
            Grid.SetRow(LayoutRoot_VertSplitter, 1);
            Grid.SetColumn(LayoutRoot_VertSplitter, 0);

            // Информация о кубе
            // Просмотрщик куба
            m_ServerExplorer = new ServerExplorerCtrl();
            m_ServerExplorer.Margin = new Thickness(0, 0, 0, 5);   // Для RanetGridSplitter
            m_ServerExplorer.CubeBrowser.DragNodes = true;
            m_ServerExplorer.CubeBrowser.DragStarted += new EventHandler<DragNodeArgs<System.Windows.Controls.Primitives.DragStartedEventArgs>>(CubeBrowser_DragStarted);
            m_ServerExplorer.CubeBrowser.DragDelta += new EventHandler<DragNodeArgs<System.Windows.Controls.Primitives.DragDeltaEventArgs>>(CubeBrowser_DragDelta);
            m_ServerExplorer.CubeBrowser.DragCompleted += new EventHandler<DragNodeArgs<System.Windows.Controls.Primitives.DragCompletedEventArgs>>(CubeBrowser_DragCompleted);
            m_ServerExplorer.CubeSelected += new EventHandler<CustomEventArgs<string>>(m_ServerExplorer_CubeSelected);

            StackPanel rowsPanel = new StackPanel() {Orientation = Orientation.Vertical};
            var cubesComboHeader = new HeaderControl(UriResources.Images.HideEmptyRows16, Localization.ColumnsHeader) { Margin = new Thickness(0, 0, 0, 3) };     
            m_columnsList = new RanetCheckedListBox();
            m_ColumnNames = new Dictionary<string,bool>();
            //m_ColumnNames.Add("Display Folder",false);
            m_ColumnNames.Add("Kpi Name",true);
            m_columnsList.AddItem(new RanetCheckedItem() { Text = "Kpi Name" , IsChecked = true});
            m_ColumnNames.Add("Kpi Value",true);
            m_columnsList.AddItem(new RanetCheckedItem() { Text = "Kpi Value", IsChecked = true });
            m_ColumnNames.Add("Kpi Goal", true);
            m_columnsList.AddItem(new RanetCheckedItem() { Text = "Kpi Goal", IsChecked = true });
            m_ColumnNames.Add("Kpi Variance", true);
            m_columnsList.AddItem(new RanetCheckedItem() { Text = "Kpi Variance", IsChecked = true });
            m_ColumnNames.Add("Trend", true);
            m_columnsList.AddItem(new RanetCheckedItem() { Text = "Trend", IsChecked = true });
            m_ColumnNames.Add("Status", true);
            m_columnsList.AddItem(new RanetCheckedItem() { Text = "Status", IsChecked = true });
            m_ColumnNames.Add("Kpi Weight", false);
            m_columnsList.AddItem(new RanetCheckedItem() { Text = "Kpi Weight", IsChecked = false });
            m_columnsList.ListBox.SelectionChanged += new SelectionChangedEventHandler(m_columnsList_SelectionChanged);
            
            Input_LayoutRoot.Children.Add(m_ServerExplorer);
            Grid.SetRow(m_ServerExplorer, 0);

            rowsPanel.Children.Add(cubesComboHeader);
            rowsPanel.Children.Add(m_columnsList);
            Input_LayoutRoot.Children.Add(rowsPanel);
            Grid.SetRow(rowsPanel, 1);

            // Заголовок
            Table_LayoutRoot = new Grid();
            Table_LayoutRoot.Margin = new Thickness(0, 3, 0, 0);
            Table_LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            Table_LayoutRoot.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            Table_LayoutRoot.RowDefinitions.Add(new RowDefinition() {Height = GridLength.Auto});
            HeaderControl pivot_Header = new HeaderControl(UriResources.Images.PivotGrid16, Localization.MdxDesigner_QueryResult) { Margin = new Thickness(0, 0, 0, 3) };
            Table_LayoutRoot.Children.Add(pivot_Header);
            Grid.SetRow(Table_LayoutRoot,0);
            m_Waiting = new BusyControl();
            m_Waiting.Text = Localization.Loading;
            Table_LayoutRoot.Children.Add(m_Waiting);
            Grid.SetRow(m_Waiting, 1);

            IsBusy = false;
            //m_OlapDataLoader = GetDataLoader();

            Table_LayoutRoot.Children.Add(m_DataGrid);
            Grid.SetRow(m_DataGrid, 2);
            // Сводная таблица            

            Pivot_Border = new Border() { Padding = new Thickness(3), BorderBrush = new SolidColorBrush(Colors.DarkGray), BorderThickness = new Thickness(1) };
            Pivot_Border.Margin = new Thickness(0, 1, 0, 0);
            Pivot_Border.Child = Table_LayoutRoot;

            Ouput_LayoutRoot.Children.Add(Pivot_Border);
            Grid.SetRow(Pivot_Border, 1);

            //var Output_HorzSplitter = new RanetGridSplitter();
            //Output_HorzSplitter.VerticalAlignment = VerticalAlignment.Bottom;
            //Output_HorzSplitter.HorizontalAlignment = HorizontalAlignment.Stretch;
            //Output_HorzSplitter.IsTabStop = false;
            //Output_HorzSplitter.Background = new SolidColorBrush(Colors.Transparent);
            //Ouput_LayoutRoot.Children.Add(Output_HorzSplitter);
            //Grid.SetRow(Output_HorzSplitter, 0);
            //Grid.SetColumn(Output_HorzSplitter, 0);            
            //

            this.Content = LayoutRoot;            
        }
		public UpdateablePivotGridControl()
		{
			RowDefinition row0 = new RowDefinition();
			row0.Height = GridLength.Auto;
			RowDefinition row1 = new RowDefinition();

			LayoutRoot.RowDefinitions.Add(row0);
			LayoutRoot.RowDefinitions.Add(row1);

			RefreshButton = new RanetToolBarButton();
			RefreshButton.Click += new RoutedEventHandler(RefreshButton_Click);
			RefreshButton.Content = UiHelper.CreateIcon(UriResources.Images.Refresh16);
			ToolTipService.SetToolTip(RefreshButton, Localization.PivotGrid_RefreshButton_ToolTip);

			ToBeginButton = new RanetToolBarButton();
			ToBeginButton.Click += new RoutedEventHandler(ToBeginButton_Click);
			ToBeginButton.Content = UiHelper.CreateIcon(UriResources.Images.ToBegin16);
			ToolTipService.SetToolTip(ToBeginButton, Localization.PivotGrid_ToBeginButton_ToolTip);

			BackButton = new RanetToolBarButton();
			BackButton.Click += new RoutedEventHandler(BackButton_Click);
			BackButton.Content = UiHelper.CreateIcon(UriResources.Images.Back16);
			ToolTipService.SetToolTip(BackButton, Localization.PivotGrid_BackButton_ToolTip);

			ForwardButton = new RanetToolBarButton();
			ForwardButton.Click += new RoutedEventHandler(ForwardButton_Click);
			ForwardButton.Content = UiHelper.CreateIcon(UriResources.Images.Forward16);
			ToolTipService.SetToolTip(ForwardButton, Localization.PivotGrid_ForwardButton_ToolTip);

			ToEndButton = new RanetToolBarButton();
			ToEndButton.Click += new RoutedEventHandler(ToEndButton_Click);
			ToEndButton.Content = UiHelper.CreateIcon(UriResources.Images.ToEnd16);
			ToolTipService.SetToolTip(ToEndButton, Localization.PivotGrid_ToEndButton_ToolTip);

			EditButton = new RanetToggleButton();
			ToolTipService.SetToolTip(EditButton, Localization.PivotGrid_EditButton_ToolTip);
			EditButton.Checked += new RoutedEventHandler(EditButton_Click);
			EditButton.Unchecked += new RoutedEventHandler(EditButton_Click);
			EditButton.Content = UiHelper.CreateIcon(UriResources.Images.EditCells16);

			UseChangesCasheButton = new RanetToggleButton();
			ToolTipService.SetToolTip(UseChangesCasheButton, Localization.PivotGrid_UseChangesCasheButton_ToolTip);
			UseChangesCasheButton.Checked += new RoutedEventHandler(UseChangesCasheButton_Checked);
			UseChangesCasheButton.Unchecked += new RoutedEventHandler(UseChangesCasheButton_Checked);
			UseChangesCasheButton.Content = UiHelper.CreateIcon(UriResources.Images.UseChangesCache16);

			CopyToClipboardButton = new RanetToolBarButton();
			ToolTipService.SetToolTip(CopyToClipboardButton, Localization.PivotGrid_CopyToClipboardButton_ToolTip);
			CopyToClipboardButton.Click += new RoutedEventHandler(CopyToClipboardoButton_Click);
			CopyToClipboardButton.Content = UiHelper.CreateIcon(UriResources.Images.Copy16);

			PasteFromClipboardButton = new RanetToolBarButton();
			ToolTipService.SetToolTip(PasteFromClipboardButton, Localization.PivotGrid_PasteFromClipboardButton_ToolTip);
			PasteFromClipboardButton.Click += new RoutedEventHandler(PasteFromClipboardoButton_Click);
			PasteFromClipboardButton.Content = UiHelper.CreateIcon(UriResources.Images.Paste16);

			ConfirmEditButton = new RanetToolBarButton(UriResources.Images.ConfirmEdit16, Localization.PivotGrid_ConfirmEditButton_Caption);
			ToolTipService.SetToolTip(ConfirmEditButton, Localization.PivotGrid_ConfirmEditButton_ToolTip);
			ConfirmEditButton.Click += new RoutedEventHandler(ConfirmEditButton_Click);

			CancelEditButton = new RanetToolBarButton();
			ToolTipService.SetToolTip(CancelEditButton, Localization.PivotGrid_CancelEditButton_ToolTip);
			CancelEditButton.Click += new RoutedEventHandler(CancelEditButton_Click);
			CancelEditButton.Content = UiHelper.CreateIcon(UriResources.Images.CancelEdit16);

			RestoreDefaultSizeButton = new RanetToolBarButton();
			ToolTipService.SetToolTip(RestoreDefaultSizeButton, Localization.PivotGrid_RestoreDefaultSize_ToolTip);
			RestoreDefaultSizeButton.Click += new RoutedEventHandler(RestoreDefaultSizeButton_Click);
			RestoreDefaultSizeButton.Content = UiHelper.CreateIcon(UriResources.Images.RestoreSize16);

			HideEmptyRowsButton = new RanetToggleButton();
			HideEmptyRowsButton.Click += new RoutedEventHandler(HideEmptyRowsButton_Click);
			HideEmptyRowsButton.Content = UiHelper.CreateIcon(UriResources.Images.HideEmptyRows16);
			ToolTipService.SetToolTip(HideEmptyRowsButton, Localization.PivotGrid_HideEmptyRowsButton_ToolTip);

			HideEmptyColumnsButton = new RanetToggleButton();
			HideEmptyColumnsButton.ClickMode = ClickMode.Press;
			HideEmptyColumnsButton.Click += new RoutedEventHandler(HideEmptyColumnsButton_Click);
			HideEmptyColumnsButton.Content = UiHelper.CreateIcon(UriResources.Images.HideEmptyColumns16);
			ToolTipService.SetToolTip(HideEmptyColumnsButton, Localization.PivotGrid_HideEmptyColumnsButton_ToolTip);

			GoToFocusedCellButton = new RanetToolBarButton();
			GoToFocusedCellButton.Click += new RoutedEventHandler(GoToFocusedCellButton_Click);
			GoToFocusedCellButton.Content = UiHelper.CreateIcon(UriResources.Images.ToFocused16);
			ToolTipService.SetToolTip(GoToFocusedCellButton, Localization.PivotGrid_GoToFocusedCellButton_ToolTip);

			ExportToExcelButton = new RanetToolBarButton();
			ToolTipService.SetToolTip(ExportToExcelButton, Localization.PivotGrid_ExportToExcelButton_ToolTip);
			ExportToExcelButton.Click += new RoutedEventHandler(ExportToExcelButton_Click);
			ExportToExcelButton.Content = UiHelper.CreateIcon(UriResources.Images.ExportToExcel16);

			RotateAxesButton = new RanetToggleButton();
			RotateAxesButton.ClickMode = ClickMode.Press;
			RotateAxesButton.Click += new RoutedEventHandler(RotateAxesButton_Click);
			RotateAxesButton.Content = UiHelper.CreateIcon(UriResources.Images.RotateAxes16);
			ToolTipService.SetToolTip(RotateAxesButton, Localization.PivotGrid_RotateAxesButton_ToolTip);

			HideHintsButton = new RanetToggleButton();
			HideHintsButton.ClickMode = ClickMode.Press;
			HideHintsButton.Click += new RoutedEventHandler(HideHintsButton_Click);
			HideHintsButton.Content = UiHelper.CreateIcon(UriResources.Images.HideHint16);
			ToolTipService.SetToolTip(HideHintsButton, Localization.PivotGrid_HideHintsButton_ToolTip);

			ConditionsDesignerButton = new RanetToggleButton();
			ConditionsDesignerButton.ClickMode = ClickMode.Press;
			ConditionsDesignerButton.Click += new RoutedEventHandler(ConditionsDesignerButton_Click);
			ConditionsDesignerButton.Content = UiHelper.CreateIcon(UriResources.Images.CellConditionsDesigner16);
			ConditionsDesignerButton.Visibility = Visibility.Collapsed;
			ToolTipService.SetToolTip(ConditionsDesignerButton, Localization.PivotGrid_CellsConditionsDesignerButton_ToolTip);

			ZoomControl = new ZoomingToolBarControl();
			ToolTipService.SetToolTip(ZoomControl, Localization.PivotGrid_ZoomingControl_ToolTip);
			ZoomControl.ValueChanged += new EventHandler(ZoomControl_ValueChanged);

			ToolBar.AddItem(RefreshButton);
			ToolBar.AddItem(m_NavigationButtons_Splitter);
			ToolBar.AddItem(ToBeginButton);
			ToolBar.AddItem(BackButton);
			ToolBar.AddItem(ForwardButton);
			ToolBar.AddItem(ToEndButton);
			NavigationToolBarSplitter = new RanetToolBarSplitter();
			ToolBar.AddItem(NavigationToolBarSplitter);
			ToolBar.AddItem(EditButton);
			ToolBar.AddItem(CopyToClipboardButton);
			ToolBar.AddItem(PasteFromClipboardButton);
			ToolBar.AddItem(UseChangesCasheButton);
			ToolBar.AddItem(ConfirmEditButton);
			ToolBar.AddItem(CancelEditButton);
			ToolBar.AddItem(new RanetToolBarSplitter());
			ToolBar.AddItem(RestoreDefaultSizeButton);
			ToolBar.AddItem(HideEmptyRowsButton);
			ToolBar.AddItem(HideEmptyColumnsButton);
			ToolBar.AddItem(GoToFocusedCellButton);
			ToolBar.AddItem(RotateAxesButton);
			ToolBar.AddItem(HideHintsButton);
			ToolBar.AddItem(ConditionsDesignerButton);
			ToolBar.AddItem(new RanetToolBarSplitter());
			ToolBar.AddItem(ExportToExcelButton);
			ToolBar.AddItem(ZoomControl);

			LayoutRoot.Children.Add(ToolBar);
			ToolBar.Margin = new Thickness(0, 0, 0, 3);

			// Сводная таблица
			//m_PivotGridPanel = new PivotGridPanel();
			//LayoutRoot.Children.Add(m_PivotGridPanel);
			//Grid.SetRow(m_PivotGridPanel, 1);

			m_PivotGrid = GetPivotGridControl();
			LayoutRoot.Children.Add(m_PivotGrid);
			Grid.SetRow(m_PivotGrid, 1);

			PivotGrid.ExecuteMemberAction += new MemberActionEventHandler(PivotGrid_ExecuteMemberAction);
			PivotGrid.CellValueChanged += new CellValueChangedEventHandler(CellsControl_CellValueChanged);
			PivotGrid.UndoCellChanges += new EventHandler(CellsControl_UndoCellChanges);
			PivotGrid.Cells_ContextMenuCreated += new EventHandler(CellsControl_ContextMenuCreated);
			PivotGrid.Columns_ContextMenuCreated += new EventHandler(ColumnsControl_ContextMenuCreated);
			PivotGrid.Rows_ContextMenuCreated += new EventHandler(RowsControl_ContextMenuCreated);
			PivotGrid.InitializeContextMenu += new EventHandler<CustomContextMenuEventArgs>(PivotGrid_InitializeContextMenu);

			UpdateToolbarButtons(null);
			UpdateEditToolBarButtons();

			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;

			PivotGrid.Cells_PerformControlAction += new EventHandler<ControlActionEventArgs<CellInfo>>(CellsControl_PerformControlAction);
			PivotGrid.Members_PerformControlAction += new EventHandler<ControlActionEventArgs<MemberControl>>(MembersArea_PerformControlAction);

			m_OlapDataLoader = GetOlapDataLoader();
			m_OlapDataLoader.DataLoaded += new EventHandler<DataLoaderEventArgs>(OlapDataLoader_DataLoaded);

			m_StorageManager = GetStorageManager();
			m_StorageManager.InvokeCompleted += new EventHandler<DataLoaderEventArgs>(StorageManager_ActionCompleted);

			// Метод Initialize необходимо вызывать для RotVisual элемента
			// всего приложения. Перенес его в ClientApp.
			//ScrollViewerMouseWheelSupport.Initialize(this);
			//m_ScrollableDataControl.ScrollView.AddMouseWheelSupport();

			this.KeyDown += new KeyEventHandler(UpdateablePivotGridControl_KeyDown);

			OlapTransactionManager.AfterCommandComplete += new EventHandler<TransactionCommandResultEventArgs>(AnalysisTransactionManager_AfterCommandComplete);
		}
        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 SlicerCtrl()
        {
            viewer = new ScrollViewer();
            viewer.BorderThickness = new Thickness(0);
            viewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            viewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;                 
            Grid LayoutRoot = new Grid();
            m_DataGrid = new Grid();
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() {Width = GridLength.Auto});
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() {MaxWidth = 20});
            LayoutRoot.RowDefinitions.Add(new RowDefinition() {MaxHeight = 20});
            LayoutRoot.RowDefinitions.Add(new RowDefinition(){ Height = GridLength.Auto});
            LayoutRoot.RowDefinitions.Add(new RowDefinition() {Height = GridLength.Auto});
            m_Panel = new StackPanel();
            m_Panel.Orientation = Orientation.Horizontal;
            m_Clear = new RanetHotButton();
            m_Clear.Width = 20;
            m_Clear.Height = 20;
            m_Clear.Content = "C";
            m_Clear.Click +=new RoutedEventHandler(m_Clear_Click);
            m_Clear.Visibility = System.Windows.Visibility.Collapsed;
            LayoutRoot.Children.Add(m_Clear);
            Grid.SetRow(m_Clear,0);
            Grid.SetColumn(m_Clear,1);
            LayoutRoot.Children.Add(m_Panel);
            Grid.SetRow(m_Panel, 1);
            Grid.SetColumn(m_Panel, 0);
            LayoutRoot.Children.Add(m_DataGrid);
            Grid.SetColumn(m_DataGrid, 0);
            Grid.SetRow(m_DataGrid, 2);

            grdIsWaiting = new Grid() { Background = new SolidColorBrush(Color.FromArgb(125, 0xFF, 0xFF, 0xFF)) };
            grdIsWaiting.Visibility = Visibility.Collapsed;
            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);

            viewer.Content = LayoutRoot;
            this.Content = viewer;
            this.SlicerHeight = 10;
            this.SlicerWidth = 10;           
            //this.m_DataGrid.MouseLeftButtonDown += new MouseButtonEventHandler(m_DataGrid_MouseLeftButtonDown);
            //this.m_DataGrid.MouseLeftButtonUp += new MouseButtonEventHandler(m_DataGrid_MouseLeftButtonUp);
            this.DirectionChanged += new EventHandler<ChangedDirectionEventArgs>(SlicerCtrl_DirectionChanged);
            
            //this.m_Panel.MouseMove += new MouseEventHandler(m_Panel_MouseMove);
            //this.Content = m_DataGrid;
        }
        public SlicerCtrl()
        {
            Grid LayoutRoot = new Grid();
            m_DataGrid = new Grid();
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() {Width = GridLength.Auto});
            LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition() {MaxWidth = 20});
            LayoutRoot.RowDefinitions.Add(new RowDefinition() {MaxHeight = 20});
            LayoutRoot.RowDefinitions.Add(new RowDefinition(){ Height = GridLength.Auto});
            LayoutRoot.RowDefinitions.Add(new RowDefinition() {Height = GridLength.Auto});
            m_Panel = new StackPanel();
            m_Panel.Orientation = Orientation.Horizontal;
            RanetHotButton m_Clear = new RanetHotButton();
            m_Clear.Width = 20;
            m_Clear.Height = 20;
            m_Clear.Content = "C";
            m_Clear.Click +=new RoutedEventHandler(m_Clear_Click);
            LayoutRoot.Children.Add(m_Clear);
            Grid.SetRow(m_Clear,0);
            Grid.SetColumn(m_Clear,1);
            LayoutRoot.Children.Add(m_Panel);
            Grid.SetRow(m_Panel, 1);
            Grid.SetColumn(m_Panel, 0);
            LayoutRoot.Children.Add(m_DataGrid);
            Grid.SetColumn(m_DataGrid, 0);
            Grid.SetRow(m_DataGrid, 2);

            m_Waiting = new BusyControl();
            m_Waiting.Text = Localization.Loading;
            //LayoutRoot.Children.Add(m_Waiting);
            //Grid.SetRow(m_Waiting, 1);

            IsBusy = false;

            this.Content = LayoutRoot;
            //this.SlicerHeight = 9;
            //this.SlicerWidth = 9;           
            //this.m_DataGrid.MouseLeftButtonDown += new MouseButtonEventHandler(m_DataGrid_MouseLeftButtonDown);
            //this.m_DataGrid.MouseLeftButtonUp += new MouseButtonEventHandler(m_DataGrid_MouseLeftButtonUp);
            this.DirectionChanged += new EventHandler<ChangedDirectionEventArgs>(SlicerCtrl_DirectionChanged);
            //this.m_Panel.MouseMove += new MouseEventHandler(m_Panel_MouseMove);
            //this.Content = m_DataGrid;
        }
        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;
        }
示例#9
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);
        }