Example #1
0
        private void btnLogout_ItemClick(object sender, DevExpress.XtraBars.Ribbon.BackstageViewItemEventArgs e)
        {
            this.Close();
            ShowFormThreadData data = new ShowFormThreadData();

            data.mainLookAndFeel = DevExpress.LookAndFeel.UserLookAndFeel.Default;
            var th = new Thread(() =>
            {
                ShowFormThreadData td = data as ShowFormThreadData;

                // this thread
#pragma warning disable 618
                DevExpress.UserSkins.OfficeSkins.Register();
#pragma warning restore 618
                DevExpress.UserSkins.BonusSkins.Register();
                DevExpress.LookAndFeel.UserLookAndFeel.Default.Assign(td.mainLookAndFeel);

                Application.Run(new Main());
            });

            th.SetApartmentState(ApartmentState.STA);
            th.Start();
            //Application.Restart();
            //Application.Restart();

            /*User.UserId = null;
             * backstageViewControl1.Close();
             * frmLogin frm = new frmLogin();
             * frm.ShowDialog();
             * Init(true);*/
        }
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            Thread thread = new Thread(new ParameterizedThreadStart(myThread_OpenForm));

            thread.IsBackground = true;
            thread.SetApartmentState(ApartmentState.STA);
            ShowFormThreadData data = new ShowFormThreadData();

            data.mainLookAndFeel = DevExpress.LookAndFeel.UserLookAndFeel.Default;
            thread.Start(data);
        }
        public static void myThread_OpenForm(object data)
        {
            ShowFormThreadData td = data as ShowFormThreadData;

            // this thread
            DevExpress.UserSkins.OfficeSkins.Register();
            DevExpress.UserSkins.BonusSkins.Register();
            DevExpress.LookAndFeel.UserLookAndFeel.Default.Assign(td.mainLookAndFeel);

            Form2 form2 = new Form2();

            td.mainLookAndFeel.StyleChanged += new EventHandler(form2.MainLookAndFeel_StyleChanged);
            form2.ShowDialog();
        }