الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

من يصحح هذا الكود ويجعل البرنامج يتعامل مع tokens

بدأه ldapguru في 25 مارس 2011 · 0 رد · 345 مشاهدة · في الإعلانات العامة
مشاركة: واتساب X فيسبوك تيليجرام
#1

بسم الله الرحمن الرحيم

اللهم ارحمنا من الكتاب الأخضر ونفي الحديث الشريف وكل من يؤمن بالكتاب الأخضر فإما الهداية وإما النصر للمجاهدين

على نية الشيخ الشعراوي

من يصحح هذا الكود ويجعل البرنامج يتعامل مع tokens

فلسفة:

في حالة التعامل مع كلمات الأفضل أن تتعامل مع token

حتى لا يبدأ البرنامج ينطر داخل الكلمة عن كلمات بها فتفسد النتيحة

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.IO;

namespace FirstTaskCS

{

/// <summary>

///

/// </summary>

public partial class frmDic : Form

{

/// <summary>

/// VARs

/// </summary>

Clss.MyDictionary MyDic = new Clss.MyDictionary();

/// <summary>

/// Initializes a new instance of the <see cref="frmDic"/> class.

/// </summary>

public frmDic()

{

InitializeComponent();

}

private void frmDic_Load(object sender, EventArgs e)

{

}

/// <summary>

/// Handles the Click event of the btnBrowsSourceFile control.

/// </summary>

/// <param name="sender">The source of the event.</param>

/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>

private void btnBrowsSourceFile_Click(object sender, EventArgs e)

{

//Prepare File Dialoge to Show

OpenFileDialog _dlgSourceFile = new OpenFileDialog();

_dlgSourceFile.Filter = "Text Files|*.txt";

_dlgSourceFile.DefaultExt = "*.txt";

_dlgSourceFile.InitialDirectory = Path.GetDirectoryName(Application.StartupPath) + "\\Data";

//

if (_dlgSourceFile.ShowDialog() == DialogResult.OK)

{

txtSorceFilePath.Text = _dlgSourceFile.FileName;

txtSourceText.Text = File.ReadAllText(_dlgSourceFile.FileName);

Clss.MyDictionary MyDic = new Clss.MyDictionary();

//Show Translated Text

txtTranslatedText.Text = MyDic.Translate(txtSourceText.Text);

}

else

{

txtSorceFilePath.Clear();

txtSourceText.Clear();

}

}

/// <summary>

/// Handles the Click event of the BtnSaveTranslatedFile control.

/// </summary>

/// <param name="sender">The source of the event.</param>

/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>

private void BtnSaveTranslatedFile_Click(object sender, EventArgs e)

{

// Prepare Save File Dialog To Show

SaveFileDialog _dlgSaveFile = new SaveFileDialog();

_dlgSaveFile.Filter = "Text Files|*.txt";

_dlgSaveFile.DefaultExt = "*.txt";

_dlgSaveFile.InitialDirectory = Path.GetDirectoryName(Application.StartupPath) + "\\Data";

_dlgSaveFile.FileName = Path.GetDirectoryName(Application.StartupPath) + "\\Data\\FILE_my.txt";

if (_dlgSaveFile.ShowDialog() == DialogResult.OK)

{

// Save Translated Text

File.WriteAllText(_dlgSaveFile.FileName, txtTranslatedText.Text);

txtTranslatedFilePath.Text = _dlgSaveFile.FileName;

}

else

{

txtTranslatedFilePath.Clear();

}

}

/// <summary>

/// Handles the TextChanged event of the txtSourceText control.

/// </summary>

/// <param name="sender">The source of the event.</param>

/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>

private void txtSourceText_TextChanged(object sender, EventArgs e)

{

//If Source Text Changed Translated Directly

txtTranslatedText.Text = MyDic.Translate(txtSourceText.Text);

// Check Source Text To Enable BtnSaveTranslatedFile or not

if (txtSourceText.Text.Trim() != string.Empty)

BtnSaveTranslatedFile.Enabled = true;

else

BtnSaveTranslatedFile.Enabled = false;

}

private void txtTranslatedText_TextChanged(object sender, EventArgs e)

{

}

}

}

اتصل بأخيك على الشيخ أحمد على

info@Muhammad.com

تم تعديل هذه المشاركة بواسطة ldapguru في 25 مارس 2011 في 13:31

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…