🙂 İNSANLARIN EN HAYIRLISI INSANLARA FAYDALI OLANDIR 🙂

Ramazan HABER / C# Athena / Loading yapmak

 

1-) C# Athena -  Loading yapmak

 

devexpress de waitform ekle ve aşağıdaki gibi yap

 

kaynak : https://stackoverflow.com/questions/510765/c-sharp-winforms-startup-splash-form-not-hiding/510786

 

...

 public WaitForm1()

        {

            InitializeComponent();

            this.progressPanel1.AutoHeight = true;

 

            progressPanel1.Caption = "Lütfen Bekleyiniz...";

            progressPanel1.Description = "Yükleniyor...";

        }

 

...

  private delegate void CloseDelegate();

 

        //The type of form to be displayed as the splash screen.

        private static WaitForm1 splashForm;

 

        static public void ShowSplashScreen()

        {

            // Make sure it is only launched once.

 

            if (splashForm != null)

                return;

            Thread thread = new Thread(new ThreadStart(WaitForm1.ShowForm));

            thread.IsBackground = true;

            thread.SetApartmentState(ApartmentState.STA);

            thread.Start();

        }

 

        static private void ShowForm()

        {

            splashForm = new WaitForm1();

            Application.Run(splashForm);

        }

 

        static public void CloseForm()

        {

            splashForm.Invoke(new CloseDelegate(WaitForm1.CloseFormInternal));

        }

 

        static private void CloseFormInternal()

        {

            splashForm.Close();

            splashForm = null;

        }

 

 

kullanımı :

      WaitForm1.ShowSplashScreen();

            for (int i = 0; i < 1000000; i++)

            {

                Console.WriteLine(""+i);

            }

            WaitForm1.CloseForm();

 

2-)  Loading yapmak

 

using System;

using System.Drawing;

using System.Threading;

using System.Windows.Forms;

 

namespace WindowsFormsApplication6

{

    public partial class Loading : Form

    {

        public Loading()

        {

            InitializeComponent();

 

            this.TransparencyKey = Color.Turquoise;

            this.BackColor = Color.Turquoise;

            BackColor = Color.Lime;

            TransparencyKey = Color.Lime;

 

            FormBorderStyle = FormBorderStyle.None;

        }

 

        private CircularProgressBar.CircularProgressBar circularProgressBar1;

 

        //Delegate for cross thread call to close

        private delegate void CloseDelegate();

 

        //The type of form to be displayed as the splash screen.

        private static Loading splashForm;

 

        static public void ShowSplashScreen()

        {

            // Make sure it is only launched once.

 

            if (splashForm != null)

                return;

            Thread thread = new Thread(new ThreadStart(Loading.ShowForm));

            thread.IsBackground = true;

            thread.SetApartmentState(ApartmentState.STA);

            thread.Start();

        }

 

        static private void ShowForm()

        {

            splashForm = new Loading();

            Application.Run(splashForm);

        }

 

        static public void CloseForm()

        {

            splashForm.Invoke(new CloseDelegate(Loading.CloseFormInternal));

        }

 

        static private void CloseFormInternal()

        {

            splashForm.Close();

            splashForm = null;

        }

 

    }

}

 

 

 

1-) C# Athena -  Loading yapmak 2

 

https://www.youtube.com/watch?v=o7MGaf8YW6s

 

yükleme için refarances- > manage nuget packgakes -> circularprogressbar -> yükledikten sonra .dll leri aşağıdaki gibi yükle

2-) .dll leri yükle

 

refarancess - > add refarances -> browse ->

D:\Athena2012\packages\CircularProgressBar.2.5.6403.13419\lib\net35-client\WinFormAnimation.dll

sonra

toolbox -> Choose items -> D:\Athena2012\packages\CircularProgressBar.2.5.6403.13419\lib\net35-client\CircularProgressBar.dll

3-) FormBorderStyle = none yap

 public Loading() {

            InitializeComponent();

            BackColor = Color.Lime;

            TransparencyKey = Color.Lime;

        }

4-) Style = Marquee yap

5-) örnek kod formu showdialog ile aç

 Thread t1;

        public void MyProgressBaslat() {

            try {

                t1 = new Thread(MyLoading);

                t1.Start();

            } catch (Exception ex) {

                AthMessageBox.MyShowMessage("HATA", "Gupd0304->MyProgressBaslat->" + ex.Message, AthMsgType.mtError);

            }

        }

        public void MyProgressDurdur() {

            try {

                if (a1!=null) {

                    a1.Close();

                    a1 = null;

                }

                t1.Abort();

            } catch (Exception ex) {

                AthMessageBox.MyShowMessage("HATA", "Gupd0304->MyProgressBaslat->" + ex.Message, AthMsgType.mtError);

            }

        }

        Loading a1=null;

        public void MyLoading() {

            try {

                a1 = new Loading();

                a1.ShowDialog();

            } catch (Exception ex) {

                AthMessageBox.MyShowMessage("HATA", "Gupd0304->MyProgressBaslat->" + ex.Message, AthMsgType.mtError);

            }

        }

 2021 Ocak 18 Pazartesi
 504