Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///How to check if form is open, and if its already open, close it:
- ///CCAPI EXAMPLE:
- ///(C#)
- using System
- using System.IO;
- if (radioTMAPI.Checked)
- {
- this.PS3.ChangeAPI(SelectAPI.TargetManager);
- }
- else
- {
- if (!File.Exists(Directory.GetCurrentDirectory() + "/CCAPI.DLL"))
- {
- CCAPIno CCno = new CCAPIno();
- ipaddress.Enabled = false;
- this.radioTMAPI.Checked = true;
- CCno.Show();
- }
- else
- {
- // this.rbtnTMAPI.Checked = true;
- }
- }
- /////////////////////////////////OTHER FORM -- The Error message saying CCAPI Doesn't exist/////////////////////////////////
- public CCAPIno()
- {
- InitializeComponent();
- this.FormClosing += this.CCAPIno_Closing;
- }
- static bool s_bFormOpened = false; // static variable that indicate the form has opened or not
- private void CCAPIno_Load(object sender, EventArgs e)
- {
- {//if one form was opened now, the current form will be closed
- if (!s_bFormOpened)
- s_bFormOpened = true;
- else
- this.Dispose();
- }
- }
- private void CCAPIno_Closing(object sender, FormClosingEventArgs e)
- {//restored the state
- if (s_bFormOpened)
- s_bFormOpened = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement