示例#1
0
        private void CloseUp()
        {
            if (!_isLethal || ModifierKeys.Equals(Keys.Shift))
            {
                try
                {
                    Logger.WriteEvent("Error Dialog: Continuing...");
                }
                catch (Exception)
                {
                    //really can't handle an embedded error related to logging
                }
                Close();
                return;
            }
            try
            {
                Logger.WriteEvent("Error Dialog: Exiting...");
            }
            catch (Exception)
            {
                //really can't handle an embedded error related to logging
            }

            Process.GetCurrentProcess().Kill();
        }
示例#2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ------------------------------------------------------------------------------------
        private void btnClose_Click(object sender, System.EventArgs e)
        {
            GatherData();

            if (radEmail.Checked)
            {
                try
                {
                    // WARNING! This currently does not work. The main issue seems to be the length of the error report. mailto
                    // apparently has some limit on the length of the message, and we are exceeding that.
                    //make it safe, but does too much (like replacing spaces with +'s)
                    //string s = System.Web.HttpUtility.UrlPathEncode( m_details.Text);
                    string body = m_details.Text.Replace(Environment.NewLine, "%0A").Replace("\"", "%22").Replace("&", "%26");

                    Process p = new Process();
                    p.StartInfo.FileName = String.Format("mailto:{0}?subject={1}&body={2}", m_emailAddress, s_emailSubject, body);
                    p.Start();
                }
                catch (Exception)
                {
                    //swallow it
                }
//				catch(Exception ex)
//				{
//					System.Diagnostics.Debug.WriteLine(ex.Message);
//					System.Diagnostics.Debug.WriteLine(ex.StackTrace);
//				}
            }
            else if (radSelf.Checked)
            {
                if (m_emailAddress != null)
                {
                    m_details.Text = string.Format(ReportingStrings.ksPleaseEMailThisTo0WithThisExactSubject12,
                                                   m_emailAddress, s_emailSubject, m_details.Text);
                }
                // Copying to the clipboard works only if thread is STA which is not the case if
                // called from the Finalizer thread
                if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA)
                {
                    ClipboardUtils.SetDataObject(m_details.Text, true);
                }
                else
                {
                    Logger.WriteEvent(m_details.Text);
                }
            }

            if (!m_isLethal || ModifierKeys.Equals(Keys.Shift))
            {
                Logger.WriteEvent("Continuing...");
                return;
            }

            m_userChoseToExit = true;
            Logger.WriteEvent("Exiting...");
            Application.Exit();
        }
示例#3
0
        /// <summary>
        /// Dictionary用比較処理
        /// </summary>
        public bool Equals(KeyInput other)
        {
            if ((Modifiers.Equals(other.Modifiers)) && (Key.Equals(other.Key)))
            {
                return(true);
            }

            return(false);
        }
示例#4
0
        private void OnDayViewMouseWheel(object sender, MouseEventArgs e)
        {
            if (ModifierKeys.Equals(Keys.Control))
            {
                bool change = ((e.Delta < 0) ? m_PrefsDlg.DecrementMinSlotHeight() : m_PrefsDlg.IncrementMinSlotHeight());

                if (change)
                {
                    m_DayView.MinSlotHeight = m_PrefsDlg.MinSlotHeight;
                }
            }
        }
示例#5
0
 public bool Equals(KeyCombination other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Key.Equals(other.Key) && ModifierKeys.Equals(other.ModifierKeys));
 }
示例#6
0
        /// <summary>
        /// キーボードのキーが押された場合に発生するイベントです。
        /// </summary>
        private new void KeyPress(KeyPressEventArgs e)
        {
            // HACK: ここ凄く適当です。修正して下さい

            var @char = e.KeyChar;

            if (@char > 0 && @char < 27)
            {
                var keys = (Keys)e.KeyChar + '@';

                var valid = new Keys[] { Keys.C, Keys.V, Keys.X, Keys.Z };

                if (ModifierKeys.Equals(Keys.Control))
                {
                    if (keys == Keys.A)
                    {
                        SelectAll();
                        e.Handled = true;
                        return;
                    }
                    else if (0 <= Array.IndexOf(valid, keys))
                    {
                        return;
                    }
                }
                else if (keys == Keys.H)
                {
                    return;
                }
            }

            var input  = Encoder.GetByteCount(new char[] { e.KeyChar }, 0, 1);
            var select = Encoder.GetByteCount(SelectedText);
            var allow  = ByteLength + input - select;

            if (allow > MaxLength)
            {
                e.Handled = true;
            }
        }
示例#7
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ------------------------------------------------------------------------------------
        private void btnClose_Click(object sender, EventArgs e)
        {
            ErrorReportSettings.Default.ReportingMethod = ((ReportingMethod)(_methodCombo.SelectedItem)).Id;
            ErrorReportSettings.Default.Save();

            if (ModifierKeys.Equals(Keys.Shift))
            {
                return;
            }
            GatherData();

            // Clipboard.SetDataObject(_details.Text, true);

            if (SelectedMethod.Method())
            {
                CloseUp();
            }
            else
            {
                PutOnClipboard();
                CloseUp();
            }
        }
示例#8
0
 private void dgFamilies_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
     {
         string famID = (string)dgFamilies.CurrentRow.Cells["FamilyID"].Value;
         Family fam   = ft.GetFamily(famID);
         if (fam != null)
         {
             if ((reportType == ReportType.MismatchedChildrenStatus || reportType == ReportType.MissingChildrenStatus) && ModifierKeys.Equals(Keys.Shift))
             {
                 List <IDisplayColourCensus> list = fam.Members.ToList <IDisplayColourCensus>();
                 ColourCensus rs = new ColourCensus(Countries.UNITED_KINGDOM, list);
                 MainForm.DisposeDuplicateForms(rs);
                 rs.Show();
                 rs.Focus();
             }
             else
             {
                 Facts factForm = new Facts(fam);
                 MainForm.DisposeDuplicateForms(factForm);
                 factForm.Show();
             }
         }
     }
 }
示例#9
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ------------------------------------------------------------------------------------
        private void btnClose_Click(object sender, System.EventArgs e)
        {
            var body = GatherData();

            if (radEmail.Checked)
            {
                var emailProvider = EmailProviderFactory.PreferredEmailProvider();
                var emailMessage  = emailProvider.CreateMessage();
                emailMessage.To.Add(m_emailAddress);
                var emailSubject = s_emailSubject;
                if (m_fReportDuplicateGuidsASAP)
                {
                    emailSubject = "Duplicate GUIDs Error Report:";
                }
                else if (m_fSuggestion)
                {
                    emailSubject = "Suggested Improvement to FLEx:";
                }
                else if (m_fUserReport)
                {
                    emailSubject = "Manual Error Report:";
                }
                emailMessage.Subject = emailSubject;
                emailMessage.Body    = body;
                if (!emailMessage.Send(emailProvider))
                {
                    MessageBox.Show(this, ReportingStrings.kstidSendFailed, ReportingStrings.kstidSendFailedCaption,
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    radSelf.Checked = true;
                    return;
                }
            }
            else if (radSelf.Checked)
            {
                if (m_emailAddress != null)
                {
                    if (m_fUserReport)
                    {
                        body = string.Format(ReportingStrings.kstidPleaseEmailThisTo0WithASuitableSubject,
                                             m_emailAddress, body);
                    }
                    else
                    {
                        body = string.Format(ReportingStrings.ksPleaseEMailThisTo0WithThisExactSubject12,
                                             m_emailAddress, s_emailSubject, body);
                    }
                }
                // Copying to the clipboard works only if thread is STA which is not the case if
                // called from the Finalizer thread
                if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA)
                {
#if __MonoCS__
                    // Workaround for Xamarin bug #4959. I had a mono fix for that bug
                    // but that doesn't work with FW - I couldn't figure out why not.
                    // This is a dirty hack but at least works :-)
                    var clipboardAtom = gdk_atom_intern("CLIPBOARD", true);
                    var clipboard     = gtk_clipboard_get(clipboardAtom);
                    if (clipboard != IntPtr.Zero)
                    {
                        gtk_clipboard_set_text(clipboard, body, -1);
                        gtk_clipboard_store(clipboard);
                    }
#else
                    ClipboardUtils.SetDataObject(body, true);
#endif
                }
                else
                {
                    Logger.WriteEvent(body);
                }
            }

            if (!m_isLethal || ModifierKeys.Equals(Keys.Shift))
            {
                Logger.WriteEvent("Continuing...");
                Close();
                return;
            }

            m_userChoseToExit = true;
            Logger.WriteEvent("Exiting...");
            Application.Exit();
        }