Пример #1
0
        private void setExportSetting(int rowIndex, int columnIndex)
        {
            if (rowIndex < 0 || columnIndex < 0)
            {
                return;
            }

            DataGridViewRow row         = this.exportSettingGridView.Rows[rowIndex];
            int             exportIndex = Plugin.GetExporterIndex("", (string)row.Cells["Format"].Value);
            ExporterInfo    info        = Plugin.Exporters[exportIndex];

            if (columnIndex == 0) // Enable
            {
                Debug.Check(Workspace.Current != null);
                Workspace.Current.SetExportInfo(info.ID, (bool)row.Cells["Enable"].EditedFormattedValue, Workspace.Current.ExportFileCount(info.ID));

                exportIndex = -1;

                for (int index = 0; index < Plugin.Exporters.Count; ++index)
                {
                    info = Plugin.Exporters[index];

                    if (Workspace.Current.ShouldBeExported(info.ID) &&
                        (exportIndex == -1 || info.HasSettings))
                    {
                        exportIndex = index;
                    }
                }

                if (exportIndex != -1)
                {
                    changeExportFormat(exportIndex);
                    _isDirty = true;
                }
            }
            else if (columnIndex == 2) // Settings
            {
                if (info.HasSettings)
                {
                    using (ExportSettingDialog dialog = new ExportSettingDialog(info))
                    {
                        dialog.ShowDialog();
                    }
                }
            }
        }
Пример #2
0
        private void exportSettingGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) {
            if (e.RowIndex < 0 || e.ColumnIndex < 0) {
                return;
            }

            DataGridViewRow row = this.exportSettingGridView.Rows[e.RowIndex];
            int exportIndex = Plugin.GetExporterIndex("", (string)row.Cells["Format"].Value);
            ExporterInfo info = Plugin.Exporters[exportIndex];

            if (e.ColumnIndex == 0) { // Enable
                Debug.Check(Workspace.Current != null);
                Workspace.Current.SetExportInfo(info.ID, (bool)row.Cells["Enable"].EditedFormattedValue, Workspace.Current.ExportedUnifiedFile(info.ID));

                exportIndex = -1;

                for (int index = 0; index < Plugin.Exporters.Count; ++index) {
                    info = Plugin.Exporters[index];

                    if (Workspace.Current.ShouldBeExported(info.ID) &&
                        (exportIndex == -1 || info.HasSettings)) {
                        exportIndex = index;
                    }
                }

                if (exportIndex != -1) {
                    changeExportFormat(exportIndex);
                    _isDirty = true;
                }

            } else if (e.ColumnIndex == 2) { // Settings
                if (info.HasSettings) {
                    using(ExportSettingDialog dialog = new ExportSettingDialog(info)) {
                        dialog.ShowDialog();
                    }
                }
            }
        }
Пример #3
0
        private void setExportSetting(int rowIndex, int columnIndex)
        {
            if (rowIndex < 0 || columnIndex < 0)
                return;

            DataGridViewRow row = this.exportSettingGridView.Rows[rowIndex];
            int exportIndex = Plugin.GetExporterIndex("", (string)row.Cells["Format"].Value);
            ExporterInfo info = Plugin.Exporters[exportIndex];

            if (columnIndex == 0) // Enable
            {
                Debug.Check(Workspace.Current != null);
                Workspace.Current.SetExportInfo(info.ID, (bool)row.Cells["Enable"].EditedFormattedValue, Workspace.Current.ExportedUnifiedFile(info.ID), Workspace.Current.GenerateCustomizedTypes(info.ID));

                exportIndex = -1;

                for (int index = 0; index < Plugin.Exporters.Count; ++index)
                {
                    info = Plugin.Exporters[index];

                    if (Workspace.Current.ShouldBeExported(info.ID) &&
                        (exportIndex == -1 || info.HasSettings))
                    {
                        exportIndex = index;
                    }
                }

                if (exportIndex != -1)
                {
                    changeExportFormat(exportIndex);
                    _isDirty = true;
                }
            }
            else if (columnIndex == 2) // Settings
            {
                if (info.HasSettings)
                {
                    using (ExportSettingDialog dialog = new ExportSettingDialog(info))
                    {
                        dialog.ShowDialog();
                    }
                }
            }
        }