Exemplo n.º 1
0
        private void BackgroundConverter_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            // if the UserState of the progress changed event arg is a string then
            // we just need to report which file is being converted right now
            // and if it's a conversion result then we report the result of the conversion of course

            var s = e.UserState as string;

            if (s != null)
            {
                LogTextbox.LogMessage(string.Format(StringResources.ConvertingFileX,
                                                    s));
            }
            else
            {
                var result = e.UserState as ConversionResult;

                if (result != null && result.ConversionWasSuccessful)
                {
                    LogTextbox.LogMessage(StringResources.FileConversionSuccessfull);
                }

                LogTextbox.LogMessage(string.Empty);
                ConversionProgressBar.Value = e.ProgressPercentage;
            }
        }
Exemplo n.º 2
0
        private void ServerSwitch(bool on = true)
        {
            if (on)
            {
                server.Listen();
                PortInput.Text = server.Port.ToString();
                AppendLog("Started server, waiting for connection...");
                LogTextbox.Select();
                UpdateLabel(ConnectionLabel, ConnectionWaiting);
                StartServerButton.Text = ServerButtonClose;
            }
            else
            {
                if (server != null)
                {
                    server.Close();
                }

                AppendLog("Closed server.");
                UpdateLabel(ConnectionLabel, ConnectionNone);
                StartServerButton.Text = ServerButtonStart;
            }
            PortInput.ReadOnly        = on;
            serverStarted             = on;
            StartServerButton.Enabled = true;
        }
Exemplo n.º 3
0
        private void LogSourceFileListChange()
        {
            SourceFilesList.Text = _filesToConvert.Aggregate("", (res, f) => res + f + "\r\n");

            LogTextbox.LogMessage(string.Format(StringResources.SelectedXFilesForConversion,
                                                _filesToConvert.Count()));
        }
Exemplo n.º 4
0
 public void log(string line, string what = "UNDEF")
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke(new logHandler(log), what, line);
     }
     else
     {
         LogTextbox.Text          += String.Format("[{0}] {1}\r\n", line, what);
         LogTextbox.SelectionStart = LogTextbox.Text.Length;
         LogTextbox.ScrollToCaret();
     }
 }
Exemplo n.º 5
0
 public void AppendLog(string message)
 {
     if (LogTextbox.InvokeRequired)
     {
         while (!LogTextbox.IsHandleCreated)
         {
             if (LogTextbox.Disposing || LogTextbox.IsDisposed)
             {
                 return;
             }
         }
         AppendLogCallback d = new AppendLogCallback(AppendLog);
         LogTextbox.Invoke(d, new object[] { message });
     }
     else
     {
         LogTextbox.Text          += "\r\n" + message;
         LogTextbox.SelectionStart = LogTextbox.TextLength;
         LogTextbox.ScrollToCaret();
     }
 }
Exemplo n.º 6
0
 public void Log(string message)
 {
     LogTextbox.AppendText("[" + DateTime.Now.ToLongTimeString() + "]::" + message + Environment.NewLine);
 }
 private void UpdateLogDisplay(string text)
 {
     LogTextbox.AppendText(text + Environment.NewLine);
     LogTextbox.ScrollToEnd();
 }
 private void ClearLogButton_Click(object sender, RoutedEventArgs e)
 {
     LogTextbox.Clear();
 }
Exemplo n.º 9
0
 private void LogSelectedTargetLanguage()
 {
     LogTextbox.LogMessage(string.Format(StringResources.TargetLanguageSetTo,
                                         TargetLangCombo.Text,
                                         TargetLangCombo.SelectedValue));
 }
Exemplo n.º 10
0
 private void ClearLogLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     LogTextbox.Clear();
 }
Exemplo n.º 11
0
 private void BackgroundConverter_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     LogTextbox.LogMessage(StringResources.CompletedMessage);
     LogTextbox.LogMessage(string.Empty);
     EnableDisabledControls();
 }
Exemplo n.º 12
0
 private void LogSelectedSourceLanguage()
 {
     LogTextbox.LogMessage(string.Format(Properties.StringResources.SourceLanguageSetTo,
                                         SourceLangCombo.Text,
                                         SourceLangCombo.SelectedValue));
 }