void m_PreviewButton_Click(object sender, RoutedEventArgs e)
        {
            ModalDialog dlg = new ModalDialog();
            dlg.MinHeight = 300;
            dlg.MinWidth = 400;
            dlg.Height = 500;
            dlg.Width = 600;
            dlg.Caption = Localization.ValueCopyDialog_Caption;
            dlg.DialogOk += new EventHandler<DialogResultArgs>(ValueCopyDialog_OkButtonClick);

            ValueCopyControl CopyControl = new ValueCopyControl();
            CopyControl.CubeName = CubeName;
            CopyControl.ConnectionID = Connection;
            CopyControl.GetOlapDataLoader += new EventHandler<GetIDataLoaderArgs>(CopyControl_GetOlapDataLoader);
            CopyControl.LogManager = this.LogManager;
            CopyControl.Initialize(m_CopyControl.GetCopySettings());
            dlg.Content = CopyControl;

            dlg.Show();
        }
		protected virtual void ShowValueCopyDialog(CellInfo cell)
		{
			if (m_CSDescr != null && cell != null && cell.IsUpdateable)
			{
				// Если в кэше есть изменения, то нужно спросить об их сохранении
				if (UseChangesCashe && PivotGrid.LocalChanges.Count > 0)
				{
					MessageBox.Show(Localization.PivotGrid_SaveCachedChanges, Localization.MessageBox_Warning, MessageBoxButton.OK);
					return;
				}

				IDictionary<String, MemberWrap> slice = new Dictionary<String, MemberWrap>();
				IDictionary<String, MemberInfo> tuple = cell.GetTuple();
				foreach (String hierarchyUniqueName in tuple.Keys)
				{
					slice.Add(hierarchyUniqueName, new MemberWrap(tuple[hierarchyUniqueName]));
				}

				ModalDialog dlg = new ModalDialog();
				dlg.MinHeight = 300;
				dlg.MinWidth = 400;
				dlg.Height = 500;
				dlg.Width = 600;
				dlg.Caption = Localization.ValueCopyDialog_Caption;
				dlg.DialogOk += new EventHandler<DialogResultArgs>(ValueCopyDialog_OkButtonClick);

				ValueCopyControl CopyControl = new ValueCopyControl();
				CopyControl.CubeName = m_CSDescr.CubeName;
				CopyControl.ConnectionID = m_CSDescr.Connection.ConnectionID;
				CopyControl.LoadMetaData += new EventHandler(ValueCopyControl_LoadMetaData);
				CopyControl.GetOlapDataLoader += new EventHandler<GetIDataLoaderArgs>(CopyControl_GetMetadataLoader);
				CopyControl.LogManager = this.LogManager;
				CopyControl.Initialize(slice, cell.Value);
				dlg.Content = CopyControl;

				ShowDialog(dlg);
			}
		}
        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;
        }