Example #1
0
        // Event handler installed for Replace dialog box "Replace All" button.
        void ReplaceDialogOnReplaceAll(object sender, EventArgs args)
        {
            ReplaceDialog dlg = sender as ReplaceDialog;
            string        str = txtbox.Text;

            strFindWhat    = dlg.FindWhat;
            strReplaceWith = dlg.ReplaceWith;
            strcomp        = dlg.MatchCase ? StringComparison.Ordinal :
                             StringComparison.OrdinalIgnoreCase;
            int index = 0;

            while (index + strFindWhat.Length < str.Length)
            {
                index = str.IndexOf(strFindWhat, index, strcomp);

                if (index != -1)
                {
                    str    = str.Remove(index, strFindWhat.Length);
                    str    = str.Insert(index, strReplaceWith);
                    index += strReplaceWith.Length;
                }
                else
                {
                    break;
                }
            }
            txtbox.Text = str;
        }
Example #2
0
        void ReplaceDialogOnReplace(object sender, EventArgs e)
        {
            ReplaceDialog dlg = sender as ReplaceDialog;

            strFindWhat    = dlg.FindWhat;
            strReplaceWith = dlg.ReplaceWith;
            strcomp        = dlg.MatchCase ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
            if (strFindWhat.Equals(txtbox.SelectedText, strcomp))
            {
                txtbox.SelectedText = strReplaceWith;
            }

            FindNext();
        }
Example #3
0
        // Event handler for Replace menu item.
        void ReplaceOnExecute(object sender, ExecutedRoutedEventArgs args)
        {
            ReplaceDialog dlg = new ReplaceDialog(this);

            dlg.FindWhat    = strFindWhat;
            dlg.ReplaceWith = strReplaceWith;
            dlg.MatchCase   = strcomp == StringComparison.Ordinal;
            dlg.Direction   = dirFind;

            // Install event handlers.
            dlg.FindNext   += FindDialogOnFindNext;
            dlg.Replace    += ReplaceDialogOnReplace;
            dlg.ReplaceAll += ReplaceDialogOnReplaceAll;

            dlg.Show();
        }
Example #4
0
        void ReplaceOnExecute(object sender, ExecutedRoutedEventArgs e)
        {
            ReplaceDialog dlg = new ReplaceDialog(this)
            {
                FindWhat    = strFindWhat,
                ReplaceWith = strReplaceWith,
                MatchCase   = strcomp == StringComparison.Ordinal,
                Direction   = dirFind
            };

            dlg.FindNext   += FindDialogOnFindNext;
            dlg.Replace    += ReplaceDialogOnReplace;
            dlg.ReplaceAll += ReplaceDialogOnReplaceAll;

            dlg.Show();
        }
        //=======================================================================================================================
        // Replace �޴� �׸� ���� �̺�Ʈ �ڵ鷯
        void ReplaceOnExecute(object sender, ExecutedRoutedEventArgs args)
        {
            ReplaceDialog dlg = new ReplaceDialog(this);

            //dlg �ʱ�ȭ
            dlg.FindWhat = strFindWhat;                     // ���� strFindWhat������ ����ִ� ���ڿ��� dlg.FindWhat�� ����
            dlg.ReplaceWith = strReplaceWith;               // ���� strReplaceWith������ ����ִ� ���ڿ� dlg.ReplaceWith�� ����
            dlg.MatchCase = strcomp == StringComparison.Ordinal;
            dlg.Direction = dirFind;                        // ���� ��ư�� ���� �˻� ���� ����Ʈ�� Down

            // Install �̺�Ʈ �ڵ鷯
            dlg.FindNext += FindDialogOnFindNext;           // FindDialogOnFindNext �̺�Ʈ ����
            dlg.Replace += ReplaceDialogOnReplace;          // ReplaceDialogOnReplace �̺�Ʈ ����
            dlg.ReplaceAll += ReplaceDialogOnReplaceAll;    // ReplaceDialogOnReplaceAll �̺�Ʈ ����

            dlg.Show();                                     // ��޸��� ���̾�α� ����
        }
        // Event handler for Replace menu item.
        void ReplaceOnExecute(object sender, ExecutedRoutedEventArgs args)
        {
            ReplaceDialog dlg = new ReplaceDialog(this);

            dlg.FindWhat = strFindWhat;
            dlg.ReplaceWith = strReplaceWith;
            dlg.MatchCase = strcomp == StringComparison.Ordinal;
            dlg.Direction = dirFind;

            // Install event handlers.
            dlg.FindNext += FindDialogOnFindNext;
            dlg.Replace += ReplaceDialogOnReplace;
            dlg.ReplaceAll += ReplaceDialogOnReplaceAll;

            dlg.Show();
        }