Пример #1
0
        void ReleaseDesignerOutlets()
        {
            if (BtnClear != null)
            {
                BtnClear.Dispose();
                BtnClear = null;
            }

            if (BtnSaveLocalCache != null)
            {
                BtnSaveLocalCache.Dispose();
                BtnSaveLocalCache = null;
            }

            if (TxtEntryfield != null)
            {
                TxtEntryfield.Dispose();
                TxtEntryfield = null;
            }

            if (TblCacheData != null)
            {
                TblCacheData.Dispose();
                TblCacheData = null;
            }
        }
Пример #2
0
 private void btnClearForm_Click(object sender, EventArgs e)
 {
     if (BtnClear != null && BtnClear.Enabled)
     {
         BtnClear.PerformClick();
     }
     else if (BtnSaveDelNNew != null && BtnSaveDelNNew.Enabled)
     {
         BtnSaveDelNNew.NewClickEvent();
     }
 }
Пример #3
0
        protected override bool ProcessDialogKey(Keys keyData)
        {
            switch (Form.ModifierKeys)
            {
            case Keys.None when keyData == Keys.Escape:
                if (ArsMessage.Question("Onay", Text + " Ekranı Kapatılacak.\nEmin Misiniz?") == DialogResult.Yes)
                {
                    this.Close();
                }
                return(true);

            case Keys.None when keyData == Keys.F10 && (BtnSave != null || btnSaveDelNew != null):
                if (BtnSave != null && BtnSave.Enabled)
                {
                    BtnSave.PerformClick();
                }
                else if (BtnSaveDelNNew != null && BtnSaveDelNNew.Enabled)
                {
                    BtnSaveDelNNew.SaveClickEvent();
                }
                break;

            case Keys.None when keyData == Keys.F11 && (BtnDel != null || btnSaveDelNew != null):
                if (BtnDel != null && BtnDel.Enabled)
                {
                    BtnDel.PerformClick();
                }
                else if (BtnSaveDelNNew != null && BtnSaveDelNNew.Enabled)
                {
                    BtnSaveDelNNew.DelClickEvent();
                }
                break;

            case Keys.None when keyData == Keys.F12 && (BtnClear != null || btnSaveDelNew != null):
                if (BtnClear != null && BtnClear.Enabled)
                {
                    BtnClear.PerformClick();
                }
                else if (BtnSaveDelNNew != null && BtnSaveDelNNew.Enabled)
                {
                    BtnSaveDelNNew.NewClickEvent();
                }
                break;
            }
            return(base.ProcessDialogKey(keyData));
        }
Пример #4
0
        private void OnLoadPlaylistMenuClick(object sender, EventArgs e)
        {
            try
            {
                if (MusicList.Items.Count > 0)
                {
                    BtnClear.PerformClick();
                }

                OpenFileDialog openDialog = new OpenFileDialog();
                openDialog.Filter = "O2Jam Music Box Playlist|*.o2p";

                if (openDialog.ShowDialog() == DialogResult.OK)
                {
                    string[] filenames = File.ReadAllLines(openDialog.FileName);
                    AddChart(filenames);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to load Playlist.\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #5
0
        void ReleaseDesignerOutlets()
        {
            if (BtnBufferSizeChange != null)
            {
                BtnBufferSizeChange.Dispose();
                BtnBufferSizeChange = null;
            }

            if (BtnClear != null)
            {
                BtnClear.Dispose();
                BtnClear = null;
            }

            if (BtnClose != null)
            {
                BtnClose.Dispose();
                BtnClose = null;
            }

            if (BtnFilter != null)
            {
                BtnFilter.Dispose();
                BtnFilter = null;
            }

            if (BtnOff != null)
            {
                BtnOff.Dispose();
                BtnOff = null;
            }

            if (BtnRefresh != null)
            {
                BtnRefresh.Dispose();
                BtnRefresh = null;
            }

            if (CboColumns != null)
            {
                CboColumns.Dispose();
                CboColumns = null;
            }

            if (CbOperator != null)
            {
                CbOperator.Dispose();
                CbOperator = null;
            }

            if (ChkAutoRefresh != null)
            {
                ChkAutoRefresh.Dispose();
                ChkAutoRefresh = null;
            }

            if (Status != null)
            {
                Status.Dispose();
                Status = null;
            }

            if (SuperLogsTableView != null)
            {
                SuperLogsTableView.Dispose();
                SuperLogsTableView = null;
            }

            if (TxtBufferSize != null)
            {
                TxtBufferSize.Dispose();
                TxtBufferSize = null;
            }

            if (TxtFilterValue != null)
            {
                TxtFilterValue.Dispose();
                TxtFilterValue = null;
            }

            if (TxtRefreshInterval != null)
            {
                TxtRefreshInterval.Dispose();
                TxtRefreshInterval = null;
            }
        }
Пример #6
0
        private void Calc(State state, TrainPacket packet, double lim, bool high, bool unlock, bool euler, bool slip)
        {
            new Task(() =>
            {
                double dist        = 0;
                List <double> vels = new List <double>();

                BtnCalc.Invoke(new Action(() => BtnCalc.Enabled   = false));
                BtnClear.Invoke(new Action(() => BtnClear.Enabled = false));
                while (state.Invoke())
                {
                    if (euler)
                    {
                        if (slip)
                        {
                            if (high)
                            {
                                if (unlock)
                                {
                                    TrainController.DoMotionWithSlip(packet, 8.0);
                                }
                                else
                                {
                                    TrainController.DoMotionWithSlip(packet, 5.0);
                                }
                            }
                            else
                            {
                                TrainController.DoMotionWithSlip(packet, 3.5);
                            }
                        }
                        else
                        {
                            if (high)
                            {
                                if (unlock)
                                {
                                    TrainController.DoMotionWithEuler(packet, 8.0);
                                }
                                else
                                {
                                    TrainController.DoMotionWithEuler(packet, 5.0);
                                }
                            }
                            else
                            {
                                TrainController.DoMotionWithEuler(packet, 3.5);
                            }
                        }
                    }
                    else
                    {
                        if (high)
                        {
                            if (unlock)
                            {
                                TrainController.DoMotionWithAirHighEx(packet);
                            }
                            else
                            {
                                TrainController.DoMotionWithAirHigh(packet);
                            }
                        }
                        else
                        {
                            TrainController.DoMotionWithAir(packet);
                        }
                    }

                    dist += packet.Velocity; vels.Add(packet.Velocity);
                    if (dist > MAX)
                    {
                        BoxDist.Invoke(new Action(() => BoxDist.Text      = "NULL"));
                        BtnCalc.Invoke(new Action(() => BtnCalc.Enabled   = true));
                        BtnClear.Invoke(new Action(() => BtnClear.Enabled = true));
                        return;
                    }
                }
                BtnCalc.Invoke(new Action(() => BtnCalc.Enabled   = true));
                BtnClear.Invoke(new Action(() => BtnClear.Enabled = true));

                BoxDist.Invoke(new Action(() => BoxDist.Text = dist.ToString("F1")));

                double max   = Max(vels);
                double step  = (double)BoxGraph.Width / (double)vels.Count;
                double scale = (double)BoxGraph.Height / max;

                for (int i = 0; i < vels.Count - 1; i++)
                {
                    g.DrawLine(
                        Pens.Black,
                        (float)(i * step), (float)((double)BoxGraph.Height - vels[i] * scale),
                        (float)((i + 1) * step), (float)((double)BoxGraph.Height - vels[i + 1] * scale)
                        );
                }

                vels.Clear();
            }).Start();
        }