نمایش نتایج 1 تا 6 از 6

نام تاپیک: عدم اجرای برنامه برای بار دوم

  1. #1

    عدم اجرای برنامه برای بار دوم

    هو العلیم
    سلام به تمامی دوستان
    سوالی داشتم چطور می شه ارنامه ای نوشت که فقط یک بار اجرا بشه
    یعنی اگر بار دوم اجرا شد پیغتم بده
    در ضمن چطور می شه برنامه رو در start upویندوز قرار داد یعنی بعد از بوت شدن خوذکار اجرا بشه

    با تشکر

  2. #2
    کاربر دائمی آواتار M.GhanaatPisheh
    تاریخ عضویت
    اردیبهشت 1383
    محل زندگی
    ----------
    پست
    1,267
    باید از singleton pattern استفاده کنید.

  3. #3

  4. #4
    هو العلیم
    با سلام خدمت شما دوستان وتشکر

    باید از singleton pattern استفاده کنید.
    می شه بیشتر توضیح بدبد
    ممنون می شم

  5. #5
    کاربر دائمی آواتار M.GhanaatPisheh
    تاریخ عضویت
    اردیبهشت 1383
    محل زندگی
    ----------
    پست
    1,267
    Consider the following example:
    You are building a quote application, which contains a class that is responsible
    for managing all of the quotes in the system. It is important that all quotes interact
    with one and only one instance of this class. How do you structure your
    design so that only one instance of this class is accessible within the application?
    A simple solution to this problem is to create a QuoteManager class with a private
    constructor so that no other class can instantiate it. This class contains a static instance
    of QuoteManager that is returned with a static method named GetInstance(). The
    code looks something like this:
    public class QuoteManager
    {
    //NOTE: For single threaded applications only
    private static QuoteManager _Instance = null;
    private QuoteManager() {}
    public static QuoteManager GetInstance()
    {
    if (_Instance==null)
    {
    _Instance = new QuoteManager ();
    }
    return _Instance;
    }
    //... functions provided by QuoteManager
    }



    It is likely that you have solved problems like this in a similar manner, as many other
    developers have. In fact, pattern writers on the lookout for recurring problems and
    solutions have observed this kind of implementation frequently, distilled the common
    solution, and documented the problem-solution pair as the Singleton pattern
    [Gamma95].
    ایده رو متوجه شدید دوست عزیز؟
    موفق باشید.

  6. #6
    هوالعلیم
    با سلام
    خیلی ممنون
    متشکرم
    عالی بود :flower: :flower:

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •