Exemplo n.º 1
0
        public OpenDataSourceDialog(ChorusAccountList chorusAccounts)
        {
            InitializeComponent();
            _chorusAccounts = chorusAccounts;

            listView.ListViewItemSorter = _listViewColumnSorter;

            DialogResult = DialogResult.Cancel;

            string[] sourceTypes =
            {
                Resources.OpenDataSourceDialog_OpenDataSourceDialog_Any_spectra_format,
                DataSourceUtil.TYPE_WIFF,
                DataSourceUtil.TYPE_AGILENT,
                DataSourceUtil.TYPE_BRUKER,
                DataSourceUtil.TYPE_SHIMADZU,
                DataSourceUtil.TYPE_THERMO_RAW,
                DataSourceUtil.TYPE_WATERS_RAW,
                DataSourceUtil.TYPE_MZML,
                DataSourceUtil.TYPE_MZXML,
                DataSourceUtil.TYPE_MZ5,
                DataSourceUtil.TYPE_UIMF
            };

            sourceTypeComboBox.Items.AddRange(sourceTypes.Cast <object>().ToArray());
            sourceTypeComboBox.SelectedIndex = 0;
            // Create a new image list for the list view that is the default size (16x16)
            ImageList imageList = new ImageList {
                ColorDepth = ColorDepth.Depth32Bit
            };

            imageList.Images.AddRange(lookInImageList.Images.Cast <Image>().ToArray());
            listView.SmallImageList = imageList;
            listView.LargeImageList = imageList;

            TreeView tv = new TreeView {
                Indent = 8
            };

            if (Settings.Default.EnableChorus)
            {
                _chorusIndex = lookInComboBox.Items.Count;
                TreeNode chorusNode = tv.Nodes.Add("Chorus", // Not L10N
                                                   Resources.OpenDataSourceDialog_OpenDataSourceDialog_Chorus_Project, (int)ImageIndex.Chorus,
                                                   (int)ImageIndex.Chorus);
                chorusNode.Tag = ChorusUrl.EMPTY;
                lookInComboBox.Items.Add(chorusNode);
                chorusButton.Visible          = true;
                recentDocumentsButton.Visible = false;
            }
            else
            {
                _chorusIndex = -1;
                TreeNode recentDocumentsNode = tv.Nodes.Add("My Recent Documents", // Not L10N
                                                            Resources.OpenDataSourceDialog_OpenDataSourceDialog_My_Recent_Documents, 0, 0);
                recentDocumentsNode.Tag = new MsDataFilePath(Environment.GetFolderPath(Environment.SpecialFolder.Recent));
                lookInComboBox.Items.Add(recentDocumentsNode);
                chorusButton.Visible          = false;
                recentDocumentsButton.Visible = true;
            }
            TreeNode desktopNode = tv.Nodes.Add("Desktop",  // Not L10N
                                                Resources.OpenDataSourceDialog_OpenDataSourceDialog_Desktop, (int)ImageIndex.Desktop, (int)ImageIndex.Desktop);

            desktopNode.Tag = new MsDataFilePath(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory));
            lookInComboBox.Items.Add(desktopNode);
            TreeNode lookInNode = desktopNode.Nodes.Add("My Documents", // Not L10N
                                                        Resources.OpenDataSourceDialog_OpenDataSourceDialog_My_Documents, (int)ImageIndex.MyDocuments, (int)ImageIndex.MyDocuments);

            lookInNode.Tag = new MsDataFilePath(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
            lookInComboBox.Items.Add(lookInNode);
            _myComputerIndex = lookInComboBox.Items.Count;
            TreeNode myComputerNode = desktopNode.Nodes.Add("My Computer", // Not L10N
                                                            Resources.OpenDataSourceDialog_OpenDataSourceDialog_My_Computer, (int)ImageIndex.MyComputer, (int)ImageIndex.MyComputer);

            myComputerNode.Tag = new MsDataFilePath(Environment.GetFolderPath(Environment.SpecialFolder.MyComputer));

            lookInComboBox.Items.Add(myComputerNode);
            _specialFolderCount = lookInComboBox.Items.Count;


            lookInComboBox.SelectedIndex  = 1;
            lookInComboBox.IntegralHeight = false;
            lookInComboBox.DropDownHeight = lookInComboBox.Items.Count * lookInComboBox.ItemHeight + 2;
        }
Exemplo n.º 2
0
        public OpenDataSourceDialog(ChorusAccountList chorusAccounts)
        {
            InitializeComponent();
            _chorusAccounts = chorusAccounts;

            listView.ListViewItemSorter = _listViewColumnSorter;

            DialogResult = DialogResult.Cancel;

            string[] sourceTypes =
            {
                Resources.OpenDataSourceDialog_OpenDataSourceDialog_Any_spectra_format,
                DataSourceUtil.TYPE_WIFF,
                DataSourceUtil.TYPE_AGILENT,
                DataSourceUtil.TYPE_BRUKER,
                DataSourceUtil.TYPE_SHIMADZU,
                DataSourceUtil.TYPE_THERMO_RAW,
                DataSourceUtil.TYPE_WATERS_RAW,
                DataSourceUtil.TYPE_MZML,
                DataSourceUtil.TYPE_MZXML,
                DataSourceUtil.TYPE_MZ5,
                DataSourceUtil.TYPE_UIMF
            };

            sourceTypeComboBox.Items.AddRange(sourceTypes.Cast<object>().ToArray());
            sourceTypeComboBox.SelectedIndex = 0;
            // Create a new image list for the list view that is the default size (16x16)
            ImageList imageList = new ImageList{ColorDepth = ColorDepth.Depth32Bit};
            imageList.Images.AddRange(lookInImageList.Images.Cast<Image>().ToArray());
            listView.SmallImageList = imageList;
            listView.LargeImageList = imageList;

            TreeView tv = new TreeView { Indent = 8 };
            if (Settings.Default.EnableChorus)
            {
                _chorusIndex = lookInComboBox.Items.Count;
                TreeNode chorusNode = tv.Nodes.Add("Chorus", // Not L10N
                    Resources.OpenDataSourceDialog_OpenDataSourceDialog_Chorus_Project, (int) ImageIndex.Chorus,
                    (int) ImageIndex.Chorus);
                chorusNode.Tag = ChorusUrl.EMPTY;
                lookInComboBox.Items.Add(chorusNode);
                chorusButton.Visible = true;
                recentDocumentsButton.Visible = false;
            }
            else
            {
                _chorusIndex = -1;
                TreeNode recentDocumentsNode = tv.Nodes.Add("My Recent Documents", // Not L10N
                    Resources.OpenDataSourceDialog_OpenDataSourceDialog_My_Recent_Documents, 0, 0);
                recentDocumentsNode.Tag = new MsDataFilePath(Environment.GetFolderPath(Environment.SpecialFolder.Recent));
                lookInComboBox.Items.Add(recentDocumentsNode);
                chorusButton.Visible = false;
                recentDocumentsButton.Visible = true;
            }
            TreeNode desktopNode = tv.Nodes.Add("Desktop",  // Not L10N
                Resources.OpenDataSourceDialog_OpenDataSourceDialog_Desktop, (int) ImageIndex.Desktop, (int) ImageIndex.Desktop );
            desktopNode.Tag = new MsDataFilePath(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory));
            lookInComboBox.Items.Add( desktopNode );
            TreeNode lookInNode = desktopNode.Nodes.Add("My Documents", // Not L10N
                Resources.OpenDataSourceDialog_OpenDataSourceDialog_My_Documents, (int) ImageIndex.MyDocuments, (int) ImageIndex.MyDocuments );
            lookInNode.Tag = new MsDataFilePath(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
            lookInComboBox.Items.Add( lookInNode );
            _myComputerIndex = lookInComboBox.Items.Count;
            TreeNode myComputerNode = desktopNode.Nodes.Add("My Computer", // Not L10N
                Resources.OpenDataSourceDialog_OpenDataSourceDialog_My_Computer, (int) ImageIndex.MyComputer, (int) ImageIndex.MyComputer );
            myComputerNode.Tag = new MsDataFilePath(Environment.GetFolderPath(Environment.SpecialFolder.MyComputer));

            lookInComboBox.Items.Add( myComputerNode );
            _specialFolderCount = lookInComboBox.Items.Count;

            lookInComboBox.SelectedIndex = 1;
            lookInComboBox.IntegralHeight = false;
            lookInComboBox.DropDownHeight = lookInComboBox.Items.Count * lookInComboBox.ItemHeight + 2;
        }