示例#1
0
 ///////////////////////////////////////////////////////
 public Client()
 {
     try
     {
         loginObj = new LoginService();
         if (loginObj == null)
         {
             Exception ex = new Exception();
             throw ex;
         }
         LoginWindow login = new LoginWindow(ref loginObj);
         Suscribe (login);
     }
     catch (NullGladeException ex)
     {
         ClientCriticalMessages.ThrowMessage(ex.Message, ex.ToString() + ":" + ex.Message);
     }
     catch (System.Exception ex)
     {
         ClientCriticalMessages.ThrowMessage(ex.StackTrace, ex.ToString() + ":" + ex.Message);
         Console.WriteLine("Imposible Conectar");
     }
 }
        //////////////////////////////////////////////////////////
        public LoginWindow(ref LoginService login_o)
        {
            try
            {
                string guipath, guicontainer;
                this.loginService = login_o;
                GuiExtractor.GetIface("Login", out guipath, out guicontainer);
                this.gui = new Glade.XML (guipath, guicontainer, "");

                if (gui.GetWidget(guicontainer) == null)
                {
                    throw new NullGladeException();  // break this try block and go to catch
                }
                else
                    this.gui.Autoconnect(this);
            }
            catch (NullGladeException ex)
            {
                throw ex;   // This windows cant be loaded, so throw the exception to the caller
            }
            catch (NullReferenceException ex)
            {
                throw new NullGladeException(ex.Message, ex);
            }
            catch (System.Exception e)
            {
                ClientMessages.ShowException(e);
            }
            permissions = new Hashtable();
        }