public void BackupServer1Thread()
        {
            int    iSize;
            float  percenTage;
            Random rd;

            if (btnStart1.Text.Equals("Start"))
            {
                btnStart1.Text = "Stop";
                btnStart1.Refresh();
                rd    = new Random();
                iSize = rd.Next(500, 1000);
                for (int i = 0; i <= iSize; i++)
                {
                    percenTage      = (((float)i / (float)iSize) * 100);
                    delUpdateStatus = new DelegateUpdateStatus(updateStatus);
                    progressBarServer1.BeginInvoke(delUpdateStatus, new object[]
                    {
                        (int)percenTage
                    });
                    //progressBarServer1.Value = (int)percenTage;
                    lblServer1.Text = (int)percenTage + "%";
                    lblServer1.Refresh();
                    Thread.Sleep(TimeSpan.FromSeconds(0.01));
                }
            }
            else
            {
                btnStart1.Text = "Start";
            }
        }
Exemplo n.º 2
0
 public frmMain()
 {
     Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
     AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
     InitializeComponent();
     m_DelegateUpdateStatus = updateStatusInBox;
     m_DelegateProgressStatus = updateProgress;
     SetupListboxWrap();
     EnableUserInput(true);
 }
Exemplo n.º 3
0
 public frmMain()
 {
     Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
     AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
     InitializeComponent();
     m_DelegateUpdateStatus   = updateStatusInBox;
     m_DelegateProgressStatus = updateProgress;
     SetupListboxWrap();
     EnableUserInput(true);
 }
Exemplo n.º 4
0
        public Form1(string[] args)
        {
            InitializeComponent();
            m_DelegateUpdateStatus = new DelegateUpdateStatus(updateStatusInBox);

            try
            {
                MM_BeginPeriod(1);
            }
            catch (Exception E)
            {
                Console.WriteLine("Failed to set thread high prio");
            }
            useCombiAdapter = set.UseCombiAdapter;

            if (args.Length > 0)
            {
                if (Convert.ToInt32(args.GetValue(0)) == 1) useCombiAdapter = true;
                else useCombiAdapter = false;
                if (args.Length > 1)
                {
                    if (Convert.ToInt32(args.GetValue(1)) == 1) autoRead = true;
                    else autoRead = false;
                    if (Convert.ToInt32(args.GetValue(1)) == 2) autoWrite = true;
                    else autoWrite = false;
                }
                if (args.Length > 2)
                {
                    fileToProcess = (string)args.GetValue(2);
                }
            }

            //TODO: Expand for ELM327 support
            // and EasySync support
            if (useCombiAdapter)
            {
                // init combi adapter library
                canUsbDevice = new LPCCANDevice_T7();
                button3.Enabled = false;
            }
            else
            {
                canUsbDevice = new CANUSBDevice();
                kwpCanDevice = new KWPCANDevice();
            }
        }
Exemplo n.º 5
0
        public frmMain(string[] args)
        {
            Thread.CurrentThread.Priority = ThreadPriority.AboveNormal;
            //System.Threading.Thread.CurrentThread.CurrentUICulture
            CultureInfo tci = new CultureInfo("nl-NL");
            Thread.CurrentThread.CurrentCulture = tci;
            splash = new frmSplash();
            splash.Show();
            System.Windows.Forms.Application.DoEvents();
            InitializeComponent();
            m_AFRMap = new AFRMap();
            m_AFRMap.onCellLocked += m_AFRMap_onCellLocked;
            m_AFRMap.onFuelmapCellChanged += m_AFRMap_onFuelmapCellChanged;

            try
            {
                sndplayer = new System.Media.SoundPlayer();
            }
            catch (Exception E)
            {
                logger.Debug(E.Message);
            }
            if (args.Length > 0)
            {
                if (args[0].ToUpper().EndsWith(".BIN"))
                {
                    if(File.Exists(args[0]))
                    {
                        m_commandLineFile = args[0];
                        m_startFromCommandLine = true;
                    }
                }
            }

            m_DelegateUpdateRealTimeValue = UpdateRealtimeInformationValue;
            m_DelegateUpdateBDMProgress = ReportBDMProgress;
            m_DelegateUpdateMapViewer = UpdateMapViewer;

            m_DelegateUpdateStatus = updateStatusInBox;
            m_DelegateProgressStatus = SetProgressPercentage;
            m_DelegateCanFrame = trionic7_onCanFrame;

            trionic7.onReadProgress += trionicCan_onReadProgress;
            trionic7.onWriteProgress += trionicCan_onWriteProgress;
            trionic7.onCanInfo += trionicCan_onCanInfo;
            trionic7.onCanFrame += trionicCan_onCanFrame;

            try
            {
                RegistryKey TempKeyCM = null;
                TempKeyCM = Registry.ClassesRoot.CreateSubKey(@"SystemFileAssociations\.bin\shell\Edit in T7 Suite\command");
                string StartKey = System.Windows.Forms.Application.ExecutablePath + " \"%1\"";
                TempKeyCM.SetValue("", StartKey);
                TempKeyCM.Close();
            }
            catch (Exception E)
            {
                logger.Debug(E.Message);
            }
            try
            {
                RegistryKey TempKeyCM = null;
                TempKeyCM = Registry.ClassesRoot.CreateSubKey(@"SystemFileAssociations\.bin\shell\Auto detect Trionic file type\command");
                string StartKey = System.Windows.Forms.Application.StartupPath + "\\SuiteLauncher.exe" + " \"%1\"";
                TempKeyCM.SetValue("", StartKey);
                TempKeyCM.Close();
            }
            catch (Exception E)
            {
                logger.Debug(E.Message);
            }

            try
            {
                // should be done only once!
                this.fio_callback = this.on_fio;
                BdmAdapter_SetFIOCallback(this.fio_callback);
                logger.Debug("BDM adapter callback set!");
                // should be done only once!

            }
            catch (Exception BDMException)
            {
                logger.Debug("BDM init failed: " + BDMException.Message);
            }

            try
            {
                m_DelegateStartReleaseNotePanel = this.StartReleaseNotesViewer;

            }
            catch (Exception E)
            {
                logger.Debug(E.Message);
            }
        }
Exemplo n.º 6
0
        public Form1(string[] args)
        {
            InitializeComponent();
            m_DelegateUpdateStatus = new DelegateUpdateStatus(updateStatusInBox);

            try
            {
                MM_BeginPeriod(1);
            }
            catch (Exception E)
            {
                Console.WriteLine("Failed to set thread high prio");
            }
            useCombiAdapter = set.UseCombiAdapter;

            if (args.Length > 0)
            {
                if (Convert.ToInt32(args.GetValue(0)) == 1)
                {
                    useCombiAdapter = true;
                }
                else
                {
                    useCombiAdapter = false;
                }
                if (args.Length > 1)
                {
                    if (Convert.ToInt32(args.GetValue(1)) == 1)
                    {
                        autoRead = true;
                    }
                    else
                    {
                        autoRead = false;
                    }
                    if (Convert.ToInt32(args.GetValue(1)) == 2)
                    {
                        autoWrite = true;
                    }
                    else
                    {
                        autoWrite = false;
                    }
                }
                if (args.Length > 2)
                {
                    fileToProcess = (string)args.GetValue(2);
                }
            }


            //TODO: Expand for ELM327 support
            // and EasySync support
            if (useCombiAdapter)
            {
                // init combi adapter library
                canUsbDevice    = new LPCCANDevice_T7();
                button3.Enabled = false;
            }
            else
            {
                canUsbDevice = new CANUSBDevice();
                kwpCanDevice = new KWPCANDevice();
            }
        }