コード例 #1
0
        private void BTN_Add_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Multiselect = true;
            dlg.Filter = "Fichiers png (*.png)|*.png";
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                WaitingForm form = new WaitingForm();
                form.Show();
                Application.DoEvents();

                for (int i = 0; i < dlg.FileNames.Count(); i++)
                {
                    using (XNAUtils utils = new XNAUtils())
                    {
                        byte[] data = File.ReadAllBytes(dlg.FileNames[i]);
                        Image image = byteArrayToImage(data);
                        Battler battler = new Battler(dlg.SafeFileNames[i], utils.ConvertToTexture(image));
                        LIST_Battlers.Items.Add(battler);
                    }
                }

                form.Close();
            }
        }
コード例 #2
0
 /// <summary>
 /// 关闭画面
 /// </summary>
 public static void CloseForm(WaitingForm window)
 {
     if (window != null)
     {
         window.Close();
         Application.Current.MainWindow.Activate();
     }
 }
コード例 #3
0
ファイル: RequestCommon.cs プロジェクト: muzeyc/CommonBaseUI
 private void CloseCallBack(WaitingForm form)
 {
     Application.Current.Dispatcher.Invoke((Action)(() =>
     {
         form.Close();
         Application.Current.MainWindow.Activate();
     }));
 }
コード例 #4
0
 private void btnImport_Click(object sender, EventArgs e) {
   var waitingForm = new WaitingForm();
   waitingForm.Show();
   var worker = new BackgroundWorker();
   worker.DoWork += (o, args) => this.LogRunningOperation(o, args);
   worker.OnWorkComplete += (o, args) => {
     waitingForm.Close();
     worker.Dispose();
   };
   worker.RunWorkerAsync();
コード例 #5
0
        private void ShowThread()
        {
            WaitingForm waitingform = new WaitingForm();

            waitingform.Text  = this.formCaption;
            waitingform.Label = this.formText;

            if (this.parentCenter != null)
            {
                waitingform.StartPosition = FormStartPosition.Manual;
                waitingform.Location      = new Point(parentCenter.X - waitingform.Width / 2, parentCenter.Y - waitingform.Height / 2);
            }
            ;

            waitingform.Show();
            waitingform.Refresh();

            while (showForm)
            {
                Application.DoEvents();

                if (waitingform.Text != this.formCaption)
                {
                    waitingform.Text = this.formCaption;
                }
                if (waitingform.Label != this.formText)
                {
                    waitingform.Label = this.formText;
                }
                waitingform.Refresh();

                if (isModal && ApplicationIsActive())
                {
                    waitingform.BringToFront();
                    waitingform.Activate();
                    waitingform.Focus();
                    waitingform.Refresh();
                }
                ;

                System.Threading.Thread.Sleep(50);
            }
            ;
            waitingform.Close();
            waitingform.Dispose();
            waitingform = null;
        }
コード例 #6
0
        private void BTN_Add_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Multiselect = true;

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                WaitingForm form = new WaitingForm();
                form.Show();
                Application.DoEvents();

                for (int i = 0; i < dlg.FileNames.Count(); i++)
                {
                    byte[] data = File.ReadAllBytes(dlg.FileNames[i]);
                    Sound sound = new Sound() { Data = data, Name = dlg.SafeFileNames[i] };

                    SoundBundle.Sounds.Add(sound);
                    LIST_Sounds.Items.Add(sound);
                }
                form.Close();
            }
        }
コード例 #7
0
ファイル: HandleWaitingForm.cs プロジェクト: v02zk/Mycoding
 public static void closeWaitingForm(WaitingForm waitForm)
 {
     waitForm.Invoke((EventHandler)delegate { waitForm.Close(); });
     waitForm = null;
 }
コード例 #8
0
        // The thread showing the waiting form
        private void THREADShowWaitingForm()
        {
            IsWaiting = true;
            WaitingForm waitingform = new WaitingForm();
            waitingform.Show();

            while (IsWaiting)
            {
                waitingform.Refresh();

                Thread.Sleep(10);
            }

            waitingform.Close();
        }
コード例 #9
0
ファイル: BMPOutput.cs プロジェクト: nickmass/Emu-o-Tron
 public void CompleteRecording()
 {
     if (recording)
     {
         WaitingForm wait = new WaitingForm(); //This should really be in its own thread to avoid hanging the gui.
         wait.Show();
         wait.Refresh();
         frame--;
         outputBlobWriter.Close();
         outputBlobWriter = null;
         BinaryReader outputBlobReader = new BinaryReader(File.OpenRead(outputPath));
         byte[] header = new byte[54];
         BinaryWriter headerBuilder = new BinaryWriter(new MemoryStream(header));
         int bmpSize = width * height * 3;
         headerBuilder.Write('B');//BMP Header
         headerBuilder.Write('M');
         headerBuilder.Write((uint)(54 + bmpSize));
         headerBuilder.Write((ushort)(0));
         headerBuilder.Write((ushort)(0));
         headerBuilder.Write((uint)(54));
         headerBuilder.Write((uint)(40));//DIB Header
         headerBuilder.Write((int)(width));
         headerBuilder.Write((int)(height));
         headerBuilder.Write((ushort)(1));
         headerBuilder.Write((ushort)(24));
         headerBuilder.Write((int)(0));
         headerBuilder.Write((uint)(bmpSize));
         headerBuilder.Write((int)(2835));//Random values for pixels/meter that I stole from a sample, hopefully they are reasonable.
         headerBuilder.Write((int)(2835));
         headerBuilder.Write((int)(0));
         headerBuilder.Write((int)(0));
         headerBuilder.Close();
         string frameStringLength = frame.ToString().Length.ToString();
         string framePath = Path.ChangeExtension(outputPath, null);
         for (int i = 0; i <= frame; i++)
         {
             FileStream frameFile = File.Create(framePath + "-" + i.ToString("D" + frameStringLength) + ".bmp");
             BinaryWriter frameWriter = new BinaryWriter(frameFile);
             frameWriter.Write(header);
             frameWriter.Write(outputBlobReader.ReadBytes(bmpSize));
             frameWriter.Close();
             wait.ReportProgress((int)((i / (frame * 1.0)) * 100));
         }
         outputBlobReader.Close();
         File.Delete(outputPath);
         recording = false;
         wait.Close();
     }
 }