private List <SampleType> GetSampleDataTypes()
        {
            var sampleDataTypes = new List <SampleType>();

            if (ConnectorTest.IsChannelOpen())
            {
                sampleDataTypes = Connector.Connector.RemoteObject.GetSampleTypes();
            }
            else
            {
                MessageBox.Show(Resources.Resources.ConnectedError, Resources.Resources.Error, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            return(sampleDataTypes);
        }
Ejemplo n.º 2
0
        private void InitConnection()
        {
            Connector.Connector.ConnectToServer();

            if (ConnectorTest.IsChannelOpen())
            {
                MessageBox.Show(Resources.Resources.ConnectedSuccess, Resources.Resources.Success, MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(Resources.Resources.ConnectedError, Resources.Resources.Error, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 3
0
        private void BindDataGrid()
        {
            if (ConnectorTest.IsChannelOpen())
            {
                var data = Connector.Connector.RemoteObject.Fetch(_sampleTypes);
                var scrollingRowIndex = DataGridViewSampleData.FirstDisplayedScrollingRowIndex;

                var currentRow = DataGridViewSampleData.CurrentCell != null
                                     ? DataGridViewSampleData.CurrentCell.RowIndex
                                     : -1;

                DataTable bindedData;
                var       currentDataSource = DataGridViewSampleData.DataSource as DataTable;
                var       newData           = Helper.ToDataTable(data);

                if (currentDataSource != null)
                {
                    currentDataSource.Merge(newData);
                    bindedData = currentDataSource;
                }
                else
                {
                    bindedData = newData;
                }

                DataGridViewSampleData.DataSource = bindedData;
                DataGridViewSampleData.Update();


                if (scrollingRowIndex > -1)
                {
                    DataGridViewSampleData.FirstDisplayedScrollingRowIndex = scrollingRowIndex;
                }

                if (currentRow > -1)
                {
                    DataGridViewSampleData.Rows[currentRow].Selected = true;
                }
            }
            else
            {
                _timer.Dispose();
                MessageBox.Show(Resources.Resources.ConnectedError, Resources.Resources.Error, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
        private void RunToolStripMenuItemClick(object sender, EventArgs e)
        {
            if (ConnectorTest.IsChannelOpen())
            {
                if (!_timerStart)
                {
                    var typesForm = new SampleDataTypesForm();
                    typesForm.ShowDialog();
                    _sampleTypes = typesForm.SelectedSampleTypes;

                    InitTimer();
                }
            }
            else
            {
                MessageBox.Show(Resources.Resources.ConnectedError, Resources.Resources.Error, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }