Beispiel #1
0
 public test(SelectLocation_Form appForm)
 {
     InitializeComponent();
     this.m_appForm = appForm;
 }
 public AllCategory_Form(SelectLocation_Form appForm)
 {
     InitializeComponent();
     this.m_appForm = appForm;
 }
        //public static bool TestService()
        //{
        //    try
        //    {
        //        Cursor.Show();
        //        Cursor.Current = Cursors.WaitCursor;
        //        System.Threading.Thread.Sleep(3000);
        //        t.Dispose();
        //        System.Net.WebRequest myRequest = System.Net.WebRequest.Create(s_url);
        //        System.Net.WebResponse myResponse = myRequest.GetResponse();
        //        myRequest.Abort();
        //        myResponse.Close();
        //    }
        //    catch (System.Net.WebException)
        //    {
        //        Cursor.Current = Cursors.Default;
        //        return false;
        //    }
        //    Cursor.Current = Cursors.Default;
        //    return true;
        //}
        private void btn_StartAudit_Click(object sender, EventArgs e)
        {
            string Header = "StartAudit::StartAudit_Load: ";
             StartAudit_Form.myLogger.Error(Header + "Entering.. ");
            try
            {
                Cursor.Show();
                Cursor.Current = Cursors.WaitCursor;

                //MemoryStream ms = new MemoryStream(16);

                if (m_IsConnected)
                {
                    m_ReaderAPI.Disconnect();
                    m_IsConnected = false;

                    m_ReaderMgmt.Dispose();
                }

                int i = 0;

                if (GlobalVariables.TestService())
                {
                    Cursor.Show();
                    Cursor.Current = Cursors.WaitCursor;

                    //System.Threading.Thread.Sleep(2000);
                    //t.Dispose();

                    audit = client.AuditSave();
                    GlobalVariables.Temp_Audit = audit;

                    if (slfm == null)
                    {
                        slfm = new SelectLocation_Form();
                    }
                    //ms.Close();
                    Cursor.Current = Cursors.Default;
                    slfm.ShowDialog();
                    slfm.Dispose();
                    slfm = null;
                    GC.Collect();
                    return;
                }
                else
                {
                    Cursor.Show();
                    Cursor.Current = Cursors.WaitCursor;

                    for (i = 0; i <= 100; i++)
                    {
                        DialogResult dialogResult = MessageBox.Show("Try to connect service", "Scan Inventory", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

                        if (dialogResult == DialogResult.Yes)
                        {
                            Cursor.Show();

                            if (GlobalVariables.TestService())
                            {
                                audit = client.AuditSave();
                                GlobalVariables.Temp_Audit = audit;

                                i = 110;
                            }
                        }
                        else if (dialogResult == DialogResult.No)
                        {
                            //MessageBox.Show("No Internet connection available", "Scan Inventory");
                            Cursor.Current = Cursors.Default;
                            return;
                        }
                    }

                    if (i == 111)
                    {
                        if (slfm == null)
                        {
                            slfm = new SelectLocation_Form();
                        }
                        //ms.Close();
                        slfm.ShowDialog();
                        slfm.Dispose();
                        slfm = null;
                        GC.Collect();
                        Cursor.Current = Cursors.Default;
                        return;
                    }
                    else
                    {
                        MessageBox.Show("No Internet connection available", "Scan Inventory");
                    }
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show("Try to connect service.", "Scan Inventory");
            }
            Cursor.Current = Cursors.Default;
        }
 public AllCategoryFormNew(SelectLocation_Form appForm,SearchCategoryForm srcCatfrm)
 {
     InitializeComponent();
     this.m_appForm = appForm;
     this.m_searchappform = srcCatfrm;
 }