コード例 #1
0
ファイル: SymbolPickerForm.cs プロジェクト: nakijun/adasg
        private void LoadDataSet(bool forceLoad)
        {
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                if (forceLoad || bufferedDataSet == null)
                {
                    LocalizedCategoryTableAdapter categoryAdapter = new LocalizedCategoryTableAdapter();
                    categoryAdapter.Fill(this.symbolDataSet.LocalizedCategory, cultureName);

                    LocalizedSymbolTableAdapter symbolAdapter = new LocalizedSymbolTableAdapter();
                    symbolAdapter.Fill(this.symbolDataSet.LocalizedSymbol, cultureName);

                    bufferedDataSet = symbolDataSet.Copy() as SymbolDataSet;
                }
                else
                {
                    symbolDataSet.Merge(bufferedDataSet);
                }
            }
            catch (Exception ex)
            {
                ReportError(ex.Message.ToString());
            }

            pickedSymbol = symbolDataSet.LocalizedSymbol.FindBySymbolId(this.currentSymbolId);

            RefreshCategoryListView();

            this.EnableButtons();

            Cursor.Current = Cursors.Default;
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: nakijun/adasg
        private void LoadDataSet()
        {
            Cursor.Current = Cursors.WaitCursor;

            int selectedCategory = 0;

            if (this.listViewCategory.SelectedIndices.Count > 0)
            {
                selectedCategory = this.listViewCategory.SelectedIndices[0];
            }

            int selectedSymbol = 0;

            if (this.listViewSymbol.SelectedIndices.Count > 0)
            {
                selectedSymbol = this.listViewSymbol.SelectedIndices[0];
            }

            try
            {
                LocalizedCategoryTableAdapter cultureAdapter = new LocalizedCategoryTableAdapter();
                cultureAdapter.Fill(this.symbolDataSet.LocalizedCategory, cultureName);

                LocalizedSymbolTableAdapter symbolAdapter = new LocalizedSymbolTableAdapter();
                symbolAdapter.Fill(this.symbolDataSet.LocalizedSymbol, cultureName);
            }
            catch (Exception ex)
            {
                ReportError(ex.Message.ToString());
            }

            RefreshCategoryListView();

            this.listViewSymbol.Clear();
            this.imageListSymbol.Images.Clear();

            if (this.listViewCategory.Items.Count > 0)
            {
                if (selectedCategory >= this.listViewCategory.Items.Count)
                {
                    selectedCategory = this.listViewCategory.Items.Count - 1;
                }

                this.listViewCategory.SelectedIndices.Clear();
                this.listViewCategory.SelectedIndices.Add(selectedCategory);
            }

            if (this.listViewSymbol.Items.Count > 0)
            {
                if (selectedSymbol >= this.listViewSymbol.Items.Count)
                {
                    selectedSymbol = this.listViewSymbol.Items.Count - 1;
                }

                this.listViewSymbol.SelectedIndices.Clear();
                this.listViewSymbol.SelectedIndices.Add(selectedSymbol);
            }

            this.EnableButtons();

            Cursor.Current = Cursors.Default;
        }