Beispiel #1
0
        /// <summary>
        /// ExceedGrid Item Source Changed handler.
        /// </summary>
        private void _OnItemSourceChanged(object sender, EventArgs e)
        {
            // select item
            if (null != _itemToSelection)
            {   // find wrapper by name
                IList <ReportDataWrapper> wrappers = _viewSourceReports.Source as IList <ReportDataWrapper>;
                for (int index = 0; index < wrappers.Count; ++index)
                {
                    ReportDataWrapper wrapper = wrappers[index];
                    if (_itemToSelection == wrapper.Name)
                    {
                        xceedGridReports.SelectedItem = wrapper;
                        break;
                    }
                }
            }
            else
            {
                xceedGridReports.SelectedIndex = Math.Min(_itemIndexToSelection, xceedGridReports.Items.Count - 1);
            }
            xceedGridReports.CurrentItem = xceedGridReports.SelectedItem;
            _itemIndexToSelection        = 0;
            _itemToSelection             = null;

            _UpdateButtonsState();
        }
Beispiel #2
0
        /// <summary>
        /// Occurs when user press "Enter" on edited grid row.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DataGridCollectionViewSource_CommittingEdit(object sender, DataGridItemCancelEventArgs e)
        {
            try
            {
                if (_isEditeStart && !string.IsNullOrEmpty(_selectedProfileName))
                {
                    ReportInfo editedInfo = App.Current.ReportGenerator.GetReportInfo(_selectedProfileName);
                    if (null != editedInfo)
                    {
                        Debug.Assert(!editedInfo.IsPredefined);

                        ReportDataWrapper selectedItem = xceedGridReports.CurrentItem as ReportDataWrapper;

                        string templatePath = ReportsGenerator.GetNewTemplatePath(selectedItem.Name, editedInfo.TemplatePath);

                        string fileSrcName  = ReportsGenerator.GetTemplateAbsolutelyPath(editedInfo.TemplatePath);
                        string fileDestName = ReportsGenerator.GetTemplateAbsolutelyPath(templatePath);
                        File.Move(fileSrcName, fileDestName);

                        _selectedProfileName = editedInfo.Name = selectedItem.Name;
                        ReportDataWrapper.StartTemplatePath = templatePath;
                        ReportDataWrapper.StartTemplateName = _selectedProfileName;
                        editedInfo.TemplatePath             = templatePath;
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                App.Current.Messenger.AddError(ex.Message);
            }

            _isEditeStart = false;
            e.Handled     = true;
        }
Beispiel #3
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Occcurs when user clicks on CheckBox.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DataCellGotFocus(object sender, RoutedEventArgs e)
        {
            ReportDataWrapper selectedItem = xceedGridReports.CurrentItem as ReportDataWrapper;

            if (null != selectedItem)
            {
                ReportInfo info = App.Current.ReportGenerator.GetReportInfo(selectedItem.Name);
                if (null != info)
                {
                    _selectedProfileName = info.Name;
                    ReportDataWrapper.StartTemplatePath = info.TemplatePath;
                    ReportDataWrapper.StartTemplateName = _selectedProfileName;

                    if (info.IsPredefined)
                    {
                        DataCell cell = sender as DataCell;
                        if (cell.ParentColumn == xceedGridReports.Columns["Name"])
                        {
                            ToolTip tt = new ToolTip();
                            tt.Style     = (Style)mainGrid.FindResource("ErrorToolTipStyle");
                            cell.ToolTip = tt;
                            cell.EndEdit();
                        }
                    }

                    if (!_isEditeStart)
                    {
                        _UpdateButtonsState();
                    }
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Occurs when user press start edit name.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DataGridCollectionViewSource_BeginningEdit(object sender, DataGridItemCancelEventArgs e)
        {
            ReportDataWrapper selectedItem = xceedGridReports.CurrentItem as ReportDataWrapper;

            if (null != selectedItem)
            {
                ReportInfo info = App.Current.ReportGenerator.GetReportInfo(selectedItem.Name);
                if (null != info)
                {
                    if (!info.IsPredefined)
                    {
                        buttonDeleteTemplate.IsEnabled = buttonEditTemplate.IsEnabled = buttonDuplicateTemplate.IsEnabled = false;
                        _isEditeStart = true;
                    }
                }
            }

            e.Handled = true;
        }
Beispiel #5
0
        /// <summary>
        /// Gets from xceed selected template info.
        /// </summary>
        /// <returns></returns>
        private ReportInfo _GetSelectedInfo()
        {
            ReportDataWrapper selectedItem = xceedGridReports.SelectedItem as ReportDataWrapper;

            return((null == selectedItem) ? null : App.Current.ReportGenerator.GetReportInfo(selectedItem.Name));
        }