Example #1
0
 private void AddToLog(string str)
 {
     LogBox.Text          += str + Environment.NewLine;
     LogBox.SelectionStart = LogBox.Text.Length;
     LogBox.ScrollToCaret();
     LogBox.Refresh();
 }
Example #2
0
 private void UpdateData(string Message)
 {
     if (LogBox.InvokeRequired)
     {
         ReceiveMessageCallBack DataCallBack = new ReceiveMessageCallBack(UpdateData);
         try
         {
             this.Invoke(DataCallBack, new Object[] { Message });
         }
         catch (ObjectDisposedException)
         {
             return;
         }
     }
     else
     {
         try
         {
             LogBox.AppendText(DateTime.Now.ToString("HH:mm:ss.ffff") + ": " + Message + Environment.NewLine);
             LogBox.SelectionStart = LogBox.TextLength;
             LogBox.ScrollToCaret();
         }
         catch (ObjectDisposedException)
         {
             return;
         }
     }
 }
Example #3
0
        public MainForm(Configuration configuration,
                        List <LogEntry> logs = null,
                        IEnumerable <string> inputFolders = null)
        {
            _configuration = configuration;
            InitializeComponent();
            VersionLabel.Text = Text = Program.VersionString;


            TopMost = Settings.Default.KeepOnTop;

            FilterTabs.SelectedTab = NoneTab;
            InitializeInput(inputFolders);
            InitializeOutput();

            if (logs?.Count > 0)
            {
                LogBox.Lines = logs.Select(x => x.ToString())
                               .ToArray();

                LogBox.SelectionStart = LogBox.Text.Length;
                LogBox.ScrollToCaret();
                MainTabs.SelectedTab = LogTab;
            }

            if (Settings.Default.FirstRun)
            {
                MainTabs.SelectedTab = OutputTab;
            }


            ConfigureCallbacks();
        }
Example #4
0
 private void LogBox_TextChanged(object sender, EventArgs e) // Скролинг событий вниз
 {
     // set the current caret position to the end
     LogBox.SelectionStart = LogBox.Text.Length;
     // scroll it automatically
     LogBox.ScrollToCaret();
 }
Example #5
0
        private void PrintLog(String log)
        {
            if (this.LogBox.InvokeRequired)
            {
                printDelegate printInvoke = new printDelegate(PrintLog);
                this.LogBox.Invoke(printInvoke, log);
            }
            else
            {
                if (LogBox.Lines.Length > 3000)
                {
                    int      index     = LogBox.Text.IndexOf("\n");
                    int      moreLines = this.LogBox.Lines.Length - 500;
                    string[] lines     = this.LogBox.Lines;
                    Array.Copy(lines, moreLines, lines, 0, 500);
                    Array.Resize(ref lines, 500);
                    this.LogBox.Lines = lines;
                }
                log = Regex.Replace(String.Format("{0}|{1}\n", DateTime.Now.ToString("hh:mm:ss"), log), @"[\r\n]+", "\r\n");
                //this.LogBox.SelectionColor = color;
                this.LogBox.AppendText(log);
                byte[] LogByte = this.SerialPort_IoT.Encoding.GetBytes(log);


                LogBox.ScrollToCaret();
            }
        }
Example #6
0
        public void Log(string message)
        {
            var    dt   = DateTime.Now;
            string time = "[" + dt.ToString("HH:mm:ss") + "]: ";

            LogBox.AppendText(time + message + System.Environment.NewLine);
            LogBox.ScrollToCaret();
        }
Example #7
0
 void SetPoint(double[,] WhatWrite) // Добавление точек на график
 {
     RichTextBoxExtensions.AppendText(LogBox, "Удачный опрос " + DateTime.Now + Environment.NewLine, Color.Black);
     ChartPower.Series["Фаза А"].Points.AddXY(DateTime.Now, WhatWrite[0, 0] * WhatWrite[1, 0] * WhatWrite[2, 0] / 1000.00);
     ChartPower.Series["Фаза B"].Points.AddXY(DateTime.Now, WhatWrite[0, 1] * WhatWrite[1, 1] * WhatWrite[2, 1] / 1000.00);
     ChartPower.Series["Фаза С"].Points.AddXY(DateTime.Now, WhatWrite[0, 2] * WhatWrite[1, 2] * WhatWrite[2, 2] / 1000.00);
     LogBox.ScrollToCaret();
     OwnerF.WriteGoodWork();
 }
Example #8
0
 private void UpdateLogBox(object sender, PropertyChangedEventArgs e)
 {
     InvokeUI(() =>
     {
         LogBox.Text           = L.Log;
         LogBox.SelectionStart = LogBox.Text.Length;
         LogBox.ScrollToCaret();
     });
 }
Example #9
0
 private void PortNameBox_SelectedValueChanged(object sender, EventArgs e)
 {
     if (Port.PortName != PortNameBox.Text)
     {
         ClosePort();
         Port.PortName = PortNameBox.Text;
         LogBox.AppendText("Имя последовательного порта изменено на " + Port.PortName + '\n');
     }
     LogBox.ScrollToCaret();
 }
Example #10
0
 private void PortSpeedBox_SelectedValueChanged(object sender, EventArgs e)
 {
     if (Port.BaudRate != (int)PortSpeedBox.SelectedItem)
     {
         ClosePort();
         Port.BaudRate = (int)PortSpeedBox.SelectedItem;
         LogBox.AppendText("Скорость порта изменена на " + Port.BaudRate.ToString() + " бод\n");
     }
     LogBox.ScrollToCaret();
 }
Example #11
0
 public void Log(string text)
 {
     if (InvokeRequired)
     {
         this.Invoke(new Action <string>(Log), new object[] { text });
         return;
     }
     LogBox.Text          += string.Format("[{0}] {1}\r\n", DateTime.Now, text);
     LogBox.SelectionStart = LogBox.TextLength;
     LogBox.ScrollToCaret();
 }
Example #12
0
 private void NextButton_Click(object sender, EventArgs e)
 {
     Game.CurrentState.NextHit();
     Game.NextState();
     Game.CurrentState.StateInit();
     PhaseCounter.Text     = "Phase: " + Game.Phase;
     CurrentState.Text     = "Current State:\n" + Game.CurrentState.ToString();
     LogBox.Text          += Game.CurrentState.Desc;
     LogBox.SelectionStart = LogBox.Text.Length;
     LogBox.ScrollToCaret();
 }
Example #13
0
 public void WriteLogMainThread(object sender, TaskList.TaskListRunEventArgs e)
 {
     if (e.ItemCount == 0)
     {
         LogBox.AppendText(string.Format("{0}-任务共执行{1}次-{2:yy-MM-dd HH:mm:ss}\r\n", e.Msg, e.AllCount));
     }
     else
     {
         LogBox.AppendText(string.Format("{0}-任务共执行{1}次-当前端口执行{2}次-{3:yy-MM-dd HH:mm:ss}\r\n", e.Msg, e.AllCount, e.ItemCount));
     }
     LogBox.AppendText(Environment.NewLine);
     LogBox.ScrollToCaret();
 }
Example #14
0
 void SetPointWithDel(double[,] WhatWrite) // Добавление точек на график с удалением
 {
     LogBox.Lines[0].Remove(0);
     RichTextBoxExtensions.AppendText(LogBox, "Удачный опрос " + DateTime.Now + Environment.NewLine, Color.Black);
     ChartPower.Series["Фаза А"].Points.RemoveAt(0);
     ChartPower.Series["Фаза А"].Points.AddXY(DateTime.Now, WhatWrite[0, 0] * WhatWrite[1, 0] * WhatWrite[2, 0] / 1000.00);
     ChartPower.Series["Фаза B"].Points.RemoveAt(0);
     ChartPower.Series["Фаза B"].Points.AddXY(DateTime.Now, WhatWrite[0, 1] * WhatWrite[1, 1] * WhatWrite[2, 1] / 1000.00);
     ChartPower.Series["Фаза С"].Points.RemoveAt(0);
     ChartPower.Series["Фаза С"].Points.AddXY(DateTime.Now, WhatWrite[0, 2] * WhatWrite[1, 2] * WhatWrite[2, 2] / 1000.00);
     ChartPower.ResetAutoValues();
     LogBox.ScrollToCaret();
     LogBox.ScrollToCaret();
 }
Example #15
0
 /// <summary>
 /// Report the progress from the BackgroundWorker.
 /// </summary>
 private void ReportProgress(int percentage, string message)
 {
     Invoke((MethodInvoker)(() =>
     {
         if (percentage >= 0 && percentage <= 100)
         {
             ProgressBar.Value = percentage;
         }
         if (message.Length > 0)
         {
             LogBox.AppendText(message + "\n");
         }
         LogBox.ScrollToCaret();
     }));
 }
Example #16
0
        /*
         *
         * Services
         *
         */
        internal void UpdateLogBox(Bot bot)
        {
            if (bot == null)
            {
                LogBox.Clear();
                return;
            }
            string text = bot.getLogBoxText();

            if (LogBox.Rtf == text)
            {
                return;
            }
            LogBox.Rtf            = text;
            LogBox.SelectionStart = LogBox.Text.Length;
            LogBox.ScrollToCaret();
        }
Example #17
0
        private void CleanFiles_Load(object sender, EventArgs e)
        {
            LogBox.SelectionStart = LogBox.Text.Length;
            LogBox.ScrollToCaret();
            MarkButton.Enabled  = false;
            CleanButton.Enabled = false;

            CurrentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) +
                          Path.DirectorySeparatorChar;
            Settings = "Configuration.json";

            if (!File.Exists(CurrentPath + Settings))
            {
                GenerateJSONConfig(CurrentPath + Settings);
            }

            Config      = JsonConvert.DeserializeObject <JSONConfig>(File.ReadAllText(CurrentPath + Settings));
            ToBeDeleted = new ArrayList();
        }
Example #18
0
 private void prnt(string log)
 {
     //Special command that cleans the LogBox.
     if (log == "$LOG_CLEAN")
     {
         LogText = ""; StringsCount = 0;
     }
     else
     {
         LogText += log + "\n";  //Append text
     }
     //Scroll to the end.
     StringsCount++;
     LogBox.Text = LogText;
     if (StringsCount > 21)
     {
         LogBox.Focus();
         LogBox.SelectionStart = LogBox.Text.Length;
         LogBox.ScrollToCaret();
     }
 }
Example #19
0
        public void LogLine(params string[] texts)
        {
            // TODO: avoid scrolling if LogBox has focus
            foreach (string text in texts)
            {
                string timestamp = "[" + DateTime.Now.ToString(DATETIME_FORMAT) + "] ";
                string messsage  = timestamp + text + "\r\n";
                LogBox.AppendText(messsage);
            }

            // trim text
            string t = LogBox.Text;

            if (t.Length > LOG_MAX_LENGTH)
            {
                int index = t.IndexOf('\n', t.Length - LOG_MAX_LENGTH);
                LogBox.Text            = t.Substring(index + 1);
                LogBox.SelectionLength = LogBox.TextLength;
                LogBox.ScrollToCaret();
            }
        }
Example #20
0
 private void ReceiveConfirm()
 {
     Port.DiscardInBuffer();
     try {
         for (int i = 0; i < 8; i++)
         {
             Port.Read(RX_buf, i, 1);
         }
         if (RX_buf[5] <= 5)
         {
             LogBox.AppendText(ERROR[RX_buf[5]]);
         }
         else
         {
             LogBox.AppendText("CONTROLLER ERROR: Код ошибки " + RX_buf[5].ToString() + '\n');
         }
     } catch {
         LogBox.AppendText("CONNECT ERROR: Таймаут ответа\n");
     }
     LogBox.ScrollToCaret();
 }
Example #21
0
        private void prnt(string log)
        {
            CheckForIllegalCrossThreadCalls = false;

            //Special command that cleans the LogBox.
            if (log == "$LOG_CLEAN")
            {
                LogBox.Text = ""; StringsCount = 0;
            }
            else
            {
                LogBox.Text += log + "\n"; //Append text
            }
            //Scroll to the end.
            StringsCount++;
            if (StringsCount > 21)
            {
                LogBox.Focus();
                LogBox.SelectionStart = LogBox.Text.Length;
                LogBox.ScrollToCaret();
            }

            File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "RNXLOG.log", log + "\n");
        }
Example #22
0
		/// <summary>
		/// OnTextChanged
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void LogBox_TextChanged(object sender, EventArgs e)
		{
			LogBox.ScrollToCaret();
		}
Example #23
0
 public void WriteLogMainThread(string msg)
 {
     LogBox.AppendText(msg);
     LogBox.AppendText(Environment.NewLine);
     LogBox.ScrollToCaret();
 }
Example #24
0
 private void GoTopMenuItem_Click(object sender, EventArgs e)
 {
     LogBox.Select(0, 0);
     LogBox.ScrollToCaret();
 }
Example #25
0
        private void dataInladen_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                dataVeld.Items.Clear();
                Gegevens?.Clear();

                switch (DataComboBox.Text)
                {
                case CustomersText:
                    if (!radioButton1.Checked)
                    {
                        _ldf.LoadDataItems("Code", "Customers", _customerInterface.GetSummaries());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Convert);
                    }
                    else
                    {
                        _ldf.LoadDataItems("Code", "Voorbeeld customers", _middlewareData.GetCustomerData());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Create, FunctionEnum.Delete);
                    }

                    LogBox.ScrollToCaret();
                    break;

                case SuppliersText:
                    if (!radioButton1.Checked)
                    {
                        _ldf.LoadDataItems("Code", "Suppliers", _supplierInterface.GetSummaries());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Convert);
                    }
                    else
                    {
                        _ldf.LoadDataItems("Code", "Voorbeeld suppliers", _middlewareData.GetSupplierData());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Create, FunctionEnum.Delete);
                    }

                    LogBox.ScrollToCaret();
                    break;

                case ArticlesText:
                    if (!radioButton1.Checked)
                    {
                        _ldf.LoadDataItems("Code", "Articles", _articleInterface.GetSummaries());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Convert);
                    }
                    else
                    {
                        _ldf.LoadDataItems("Code", "Voorbeeld articles", _middlewareData.GetProductData());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Create, FunctionEnum.Delete);
                    }

                    LogBox.ScrollToCaret();
                    break;

                case SalesInvoicesText:
                    if (!radioButton1.Checked)
                    {
                        LogBox.AppendText("\r\nSales invoices inladen...");
                        foreach (var s in _salesInvoiceInterface.GetAll())
                        {
                            if (!dataVeld.Items.Contains(s.Header))
                            {
                                Gegevens?.Add(s.Header);
                                dataVeld.Items.Add(s.Header);
                            }
                        }

                        dataVeld.SelectedIndex = 0;
                        dataVeld.DisplayMember = "InvoiceTypeAndNumber";
                        LogBox.AppendText("\r\nSales invoices geladen");
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Convert);
                    }
                    else
                    {
                        _ldf.LoadDataItems("InvoiceTypeAndNumber", "Voorbeeld sales invoice",
                                           _middlewareData.GetSalesInvoiceData());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Create);
                    }

                    LogBox.ScrollToCaret();
                    break;

                case BalanceSheetsText:
                    if (!radioButton1.Checked)
                    {
                        _ldf.LoadDataItems("Code", "Balance sheets", _balanceSheetInterface.GetSummaries());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Convert);
                    }
                    else
                    {
                        _ldf.LoadDataItems("Code", "Voorbeels balance sheets", _middlewareData.GetBalanceSheetData());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Create, FunctionEnum.Delete);
                    }

                    LogBox.ScrollToCaret();
                    break;

                case ProfitAndLossText:
                    if (!radioButton1.Checked)
                    {
                        _ldf.LoadDataItems("Code", "Profit and loss", _profitLossInterface.GetSummaries());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Convert);
                    }
                    else
                    {
                        _ldf.LoadDataItems("Code", "Voorbeeld profit and loss", _middlewareData.GetProfitAndLossData());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Create, FunctionEnum.Delete);
                    }

                    LogBox.ScrollToCaret();
                    break;

                case CostCentersText:
                    if (!radioButton1.Checked)
                    {
                        _ldf.LoadDataItems("Code", "Cost centers", _costCenterInterface.GetSummaries());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Convert);
                    }
                    else
                    {
                        _ldf.LoadDataItems("Code", "Voorbeeld cost center", _middlewareData.GetCostCenterData());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Create, FunctionEnum.Delete);
                    }

                    LogBox.ScrollToCaret();
                    break;
                }

                LogBox.ScrollToCaret();
                functie.Enabled          = true;
                functieUitvoeren.Enabled = true;
                dataVeld.Enabled         = true;
                this.Cursor         = Cursors.Arrow;
                resultBar.BackColor = Color.Chartreuse;
            }
            catch (Exception ex)
            {
                this.Cursor         = Cursors.Arrow;
                resultBar.BackColor = Color.Red;
                LogBox.AppendText("\r\nDe data kan niet ingeladen worden");
                LogBox.AppendText("\r\nError: " + ex.Message);
            }
        }
Example #26
0
        private void functieUitvoeren_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            if (!radioButton1.Checked)
            {
                switch (functie.Text)
                {
                case ReadText:

                    try
                    {
                        switch (DataComboBox.Text)
                        {
                        case CustomersText:
                            _ldf.LoadData(_customerInterface.Read(dataVeld.GetItemText(dataVeld.SelectedItem)));
                            break;

                        case SuppliersText:
                            _ldf.LoadData(_supplierInterface.Read(dataVeld.GetItemText(dataVeld.SelectedItem)));
                            break;

                        case ArticlesText:
                            _ldf.LoadData(_articleInterface.Read(dataVeld.GetItemText(dataVeld.SelectedItem)));
                            break;

                        case SalesInvoicesText:
                            var      data  = dataVeld.GetItemText(dataVeld.SelectedItem);
                            string[] items = data.Split(',');
                            _ldf.LoadData(_salesInvoiceInterface.Read(items[1], items[0]));
                            break;

                        case BalanceSheetsText:
                            _ldf.LoadData(_balanceSheetInterface.Read(dataVeld.GetItemText(dataVeld.SelectedItem)));
                            break;

                        case ProfitAndLossText:
                            _ldf.LoadData(_profitLossInterface.Read(dataVeld.GetItemText(dataVeld.SelectedItem)));
                            break;

                        case CostCentersText:
                            _ldf.LoadData(_costCenterInterface.Read(dataVeld.GetItemText(dataVeld.SelectedItem)));
                            break;
                        }

                        this.Cursor = Cursors.Arrow;
                        break;
                    }
                    catch (Exception ex)
                    {
                        this.Cursor         = Cursors.Arrow;
                        resultBar.BackColor = Color.Red;
                        LogBox.AppendText("\r\nDe data kan niet gelezen worden");
                        LogBox.AppendText("\r\nError: " + ex.Message);
                        break;
                    }

                case ConvertText:
                    try
                    {
                        switch (DataComboBox.Text)
                        {
                        case CustomersText:
                            _ldf.ConvertData(_customerInterface.Read(dataVeld.GetItemText(dataVeld.SelectedItem)));
                            break;

                        case SuppliersText:
                            _ldf.ConvertData(_supplierInterface.Read(dataVeld.GetItemText(dataVeld.SelectedItem)));
                            break;

                        case ArticlesText:
                            _ldf.ConvertData(_articleInterface.Read(dataVeld.GetItemText(dataVeld.SelectedItem)));
                            break;

                        case SalesInvoicesText:
                            var      data  = dataVeld.GetItemText(dataVeld.SelectedItem);
                            string[] items = data.Split(',');
                            _ldf.ConvertData(_salesInvoiceInterface.Read(items[1], items[0]));
                            break;

                        case BalanceSheetsText:
                            _ldf.ConvertData(_balanceSheetInterface.Read(dataVeld.GetItemText(dataVeld.SelectedItem)));
                            break;

                        case ProfitAndLossText:
                            _ldf.ConvertData(_profitLossInterface.Read(dataVeld.GetItemText(dataVeld.SelectedItem)));
                            break;

                        case CostCentersText:
                            _ldf.ConvertData(_costCenterInterface.Read(dataVeld.GetItemText(dataVeld.SelectedItem)));
                            break;
                        }
                        break;
                    }
                    catch (Exception exception)
                    {
                        LogBox.AppendText(
                            "\r\nDe data kan niet geconverteerd worden naar de middleware");
                        LogBox.AppendText("\r\nError: " + exception.Message);
                        Cursor.Current      = Cursors.Arrow;
                        resultBar.BackColor = Color.Red;
                        break;
                    }

                case @"None":
                    LogBox.AppendText("\r\nEr moet eerst data ingeladen worden.");
                    break;
                }
            }
            else
            {
                switch (functie.Text)
                {
                case ReadText:
                    switch (DataComboBox.Text)
                    {
                    case CustomersText:

                        _ldf.LoadDataMiddleware(typeof(CustomerResponse), Gegevens);
                        break;

                    case SuppliersText:
                        _ldf.LoadDataMiddleware(typeof(SupplierResponse), Gegevens);
                        break;

                    case ArticlesText:
                        _ldf.LoadDataMiddleware(typeof(Product), Gegevens);
                        break;

                    case SalesInvoicesText:
                        _ldf.LoadDataMiddleware(typeof(SalesInvoiceResponse), Gegevens);
                        break;

                    case BalanceSheetsText:
                        _ldf.LoadDataMiddleware(typeof(GeneralLedgerResponse), Gegevens);
                        break;

                    case ProfitAndLossText:
                        _ldf.LoadDataMiddleware(typeof(GeneralLedgerResponse), Gegevens);
                        break;

                    case CostCentersText:
                        _ldf.LoadDataMiddleware(typeof(CostCenterResponse), Gegevens);
                        break;
                    }

                    break;

                case CreateText:
                    switch (DataComboBox.Text)
                    {
                    case CustomersText:
                        _ldf.ChangeData(DataChangeTypes.Create, typeof(CustomerResponse), Gegevens);
                        break;

                    case SuppliersText:
                        _ldf.ChangeData(DataChangeTypes.Create, typeof(SupplierResponse), Gegevens);
                        break;

                    case ArticlesText:
                        _ldf.ChangeData(DataChangeTypes.Create, typeof(Product), Gegevens);
                        break;

                    case SalesInvoicesText:
                        _ldf.ChangeData(DataChangeTypes.Create, typeof(SalesInvoiceResponse), Gegevens);
                        break;

                    case BalanceSheetsText:
                        _ldf.ChangeData(DataChangeTypes.Create, typeof(GeneralLedgerResponse), Gegevens);
                        break;

                    case ProfitAndLossText:
                        _ldf.ChangeData(DataChangeTypes.Create, typeof(GeneralLedgerResponse), Gegevens);
                        break;

                    case CostCentersText:
                        _ldf.ChangeData(DataChangeTypes.Create, typeof(CostCenterResponse), Gegevens);
                        break;
                    }

                    break;

                case DeleteText:
                    switch (DataComboBox.Text)
                    {
                    case CustomersText:
                        _ldf.ChangeData(DataChangeTypes.Delete, typeof(CustomerResponse), Gegevens);
                        break;

                    case SuppliersText:
                        _ldf.ChangeData(DataChangeTypes.Delete, typeof(SupplierResponse), Gegevens);
                        break;

                    case ArticlesText:
                        _ldf.ChangeData(DataChangeTypes.Delete, typeof(Product), Gegevens);
                        break;

                    case SalesInvoicesText:
                        LogBox.AppendText(
                            "\r\nSales invoices kunnen niet verwijderd worden in Twinfield");
                        break;

                    case BalanceSheetsText:
                        _ldf.ChangeData(DataChangeTypes.Delete, typeof(GeneralLedgerResponse), Gegevens);
                        break;

                    case ProfitAndLossText:
                        _ldf.ChangeData(DataChangeTypes.Delete, typeof(GeneralLedgerResponse), Gegevens);
                        break;

                    case CostCentersText:
                        _ldf.ChangeData(DataChangeTypes.Delete, typeof(CostCenterResponse), Gegevens);
                        break;
                    }
                    break;
                }
            }

            LogBox.ScrollToCaret();
        }
Example #27
0
        private void ScrollDownLog()
        {
            LogBox.SelectionStart = LogBox.Text.Length;

            LogBox.ScrollToCaret();
        }
Example #28
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="message"></param>
 void Trace_OnTrace(string message)
 {
     LogBox.AppendText(message);
     LogBox.Select(LogBox.Text.Length, 0);
     LogBox.ScrollToCaret();
 }
Example #29
0
 //**************************************************************************//
 private void LogBox_TextChanged(object sender, EventArgs e)
 {
     LogBox.SelectionStart = LogBox.Text.Length;
     LogBox.ScrollToCaret();
 }
Example #30
0
        //deletes extracted movie files with the same file name as fi
        private long DeleteFiles(FileInfo fi)
        {
            Application.DoEvents();

            long dataDeleted = 0;

            try
            {
                SevenZipExtractor archive = new SevenZipExtractor(fi.FullName);
                int FailedFileCount       = 0;
                foreach (SevenZip.ArchiveFileInfo archiveFileData in archive.ArchiveFileData)
                {
                    if (FailedFileCount > 10)
                    {
                        return(dataDeleted);
                    }
                    String fileName = fi.DirectoryName + "\\" + archiveFileData.FileName;
                    if (fileName.Contains("nfo") || fileName.Contains("diz"))
                    {
                        continue;
                    }
                    if (File.Exists(fileName))
                    {
                        FailedFileCount = 0;
                        try
                        {
                            //Get the file size and attempt to delete the file
                            long length = new FileInfo(fileName).Length;
                            if (DontDelete.Checked)
                            {
                                LogBox.Text += "File found: \n" + fileName + "\n";
                            }
                            else
                            {
                                File.Delete(fileName);
                                //Only do this if we actually deleted the file
                                LogBox.Text += "Deleted file: \n" + fileName + "\n";
                            }
                            dataDeleted += length;
                            DeletedFileCount++;
                            DeletedFileCountBox.Text = DeletedFileCount.ToString();
                        }
                        catch (Exception e)
                        {
                            LogBox.Text += "Failed to delete: " + fileName + " due to: " + e.Message + "\n";
                        }
                    }
                    else
                    {
                        FailedFileCount++;
                    }
                }
            }
            catch (Exception ex)
            {
                LogBox.Text += "Failed to open archive: " + fi.FullName + " due to error: " + ex.Message + "\n";
            }

            LogBox.SelectionStart = LogBox.Text.Length;
            LogBox.ScrollToCaret();
            return(dataDeleted);
        }