コード例 #1
0
        private void UxStartButton_Click(object sender, EventArgs e)
        {
            Trace.TraceInformation(Util.GetCurrentMethodName());

            if (this.recordContext == null)
            {
                var device = this.sumacon.DeviceManager.ActiveDevice;
                if (device == null)
                {
                    return;
                }
                var setting = this.GetRecordSetting(device);
                this.recordContext = RecordContext.StartNew(device, setting, state =>
                {
                    this.SafeInvoke(() => this.OnRecordContextStateChanged(state));
                });
                this.elapsedTimeRedrawTimer.Start();
                this.sumacon.DeviceManager.SuspendPropertyUpdate(device);
            }
            else
            {
                this.elapsedTimeRedrawTimer.Stop();
                this.recordContext.Stop();
            }
            this.UpdateControlState();
        }
コード例 #2
0
        public static RecordContext StartNew(Device device, RecordSetting setting, Action <RecordState> onStateChanged)
        {
            var instance = new RecordContext();

            instance.Device         = device;
            instance.setting        = setting;
            instance.onStateChanged = onStateChanged;
            instance.StartRecord();
            return(instance);
        }
コード例 #3
0
        void OnRecordContextStateChanged(RecordContext.RecordState state)
        {
            if (state == RecordContext.RecordState.Pulling)
            {
                this.elapsedTimeRedrawTimer.Stop();
            }
            else if (state == RecordContext.RecordState.Aborted)
            {
                this.sumacon.DeviceManager.ResumePropertyUpdate(this.recordContext?.Device);
                this.recordContext = null;
            }
            else if (state == RecordContext.RecordState.Finished)
            {
                this.sumacon.DeviceManager.ResumePropertyUpdate(this.recordContext.Device);

                this.fileInfos.Add(new FileInfo(this.recordContext.FilePath));

                //TODO: これGridPanel側でできるようにしたい...
                var rowCount      = this.uxFileGridPanel.Rows.Count;
                var lastBeforeRow = (rowCount >= 2) ? this.uxFileGridPanel.Rows[rowCount - 2] : null;
                if (lastBeforeRow != null && lastBeforeRow.Selected)
                {
                    if (this.uxFileGridPanel.SelectedRows.Count == 1)
                    {
                        lastBeforeRow.Selected = false;
                    }
                    this.uxFileGridPanel.Rows[rowCount - 1].Selected     = true;
                    this.uxFileGridPanel.FirstDisplayedScrollingRowIndex = rowCount - 1;
                }
                this.recordContext = null;
                this.sequenceNo++;
            }
            else
            {
                ;
            }
            this.UpdateControlState();
        }