guclusat

Tanınmış Üye
Süper Moderatör
Use the Status Dialog
In AutoPlay Media Studio, it is possible to display a status dialog to your user using built in actions. This is
useful if, for example, your application uses a loop that takes quite a bit of time to complete.
As an example, we will create a loop that counts to 20,000, and display a status window letting the user
know the status of the count:

1. Create a button object, and add the following code to its On Click event:
Kod:
--set the minimum and maximum values
minimum_value = 0;
maximum_value = 20000;
--status dialog window settings
StatusDlg.Show(); --show the status dialog window
StatusDlg.SetTitle("Counting from " .. minimum_value .. " to " ..
maximum_value); --set the title
StatusDlg.SetMeterRange(minimum_value, maximum_value); --set the
range of the meter
--counting loop
loop_control = minimum_value; --set the loop control variable
while loop_control <= maximum_value do --while the loop control
variable is less than or equal to the maximum value
StatusDlg.SetMeterPos(loop_control); --set the meter position
to the loop control variable
StatusDlg.SetStatusText("Currently Counting . . . (" ..
loop_control .. " of " .. maximum_value .. ")"); --set the status
text to reflect the current number
loop_control = loop_control + 1; --increment the loop control
variable
end
Note: The above code when run will count to 20,000, and display a status dialog showing
the progress of the loop.
 

AMS'de Status Dialog (Durum Penceresi) Kullanımı​

Status Dialog, projenizden bağımsız olarak üstte açılan küçük bir penceredir ve genellikle File.Run veya File.Copy gibi beklemeli işlemler sırasında kullanılır.

1. Temel Fonksiyonlar​

  • StatusDummy.Show: Pencereyi ekranda göstermeye yarar.
  • StatusDummy.SetStatusText: Penceredeki metni (örneğin kurulan programın adını) anlık olarak değiştirmeyi sağlar.
  • StatusDummy.Hide (veya Show false): İşlem bittiğinde pencereyi kapatır.

2. Uygulamalı Kod Örneği​

AIO projenizde bir programı kurarken kullanıcıya bilgi vermek için şu yapıyı kullanmalısınız:
Kod:
-- 1. Pencereyi aç ve ilk mesajı yaz
StatusDummy.Show(true, "Hazırlanıyor...", "Lütfen bekleyin.");

-- 2. Mesajı güncelle (Örneğin kurulum başladığında)
StatusDummy.SetStatusText("WinRAR v7.0 Kuruluyor...");
File.Run("AutoPlay\\Docs\\winrar.exe", "/S", "", SW_SHOWNORMAL, true);

-- 3. Mesajı tekrar güncelle (Sonraki program için)
StatusDummy.SetStatusText("Google Chrome Kuruluyor...");
File.Run("AutoPlay\\Docs\\chrome.exe", "/silent", "", SW_SHOWNORMAL, true);

-- 4. Pencereyi gizle
StatusDummy.Show(false);

Dialog.Message("Tamamlandı", "Tüm işlemler başarıyla bitirildi.", MB_OK, MB_ICONINFORMATION);

3. Profesyonel İpucu: Status Dialog'u Özelleştirme​

Status Dialog'un sadece metnini değil, görünümünü de değiştirebilirsiniz. Project &gt; Settings &gt; Status Dialog menüsünden:
  • Pencerenin ekranın neresinde duracağını (merkez, alt, üst),
  • Arka plan rengini veya resmini,
  • İçindeki Progress Bar'ın görünüp görünmeyeceğini ayarlayabilirsiniz.

Teknik İpucu (Usta Notu)​

Dükkanda hazırladığın teknik servis araçlarında (örneğin bir yedekleme programı), Status Dialog kullanmak müşterinin güvenini artırır. Eğer işlem çok uzun sürüyorsa (örneğin 500GB veri kopyalıyorsan), StatusDummy.SetStatusText içine o an kopyalanan dosyanın adını veya yüzdesini yazdırarak işlemin canlı olduğunu kanıtlayabilirsin.
 
Geri
Yukarı