Exemplo n.º 1
0
        void TestExceptions()
        {
            CreativeStaff cs = null;

            //Disable next statement for catching exception in try/catch block
            cs.calculateBonus();
            try
            {
                int a         = 3;
                int b         = 0;
                int resultaat = a / b;

                cs.calculateBonus();
            }
            //catch(NullReferenceException nrex)
            //{
            //	cs = new CreativeStaff ();
            //	//ShowException (nrex.ToString ());
            //}
            catch (System.Exception ex)
            {
                if (ex.GetType() == typeof(NullReferenceException))
                {
                }
                ShowException(ex.ToString());
            }
            finally
            {
            }
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            //This method will activate the improved exceptionhandling
            ExceptionHandleUtil.GeneralExceptionHandler.SetGeneralExceptionHandler();

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            outputThread = new System.Threading.Thread(new ThreadStart(StartOutputThread));

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button> (Resource.Id.btn_input);

            button.Click += delegate {
                outputThread.Start();
            };

            CreativeStaff cs = new CreativeStaff();

            // assigning set property
            //cs.StaffNo = 5;
            // accessing get property
            //int getal = cs.StaffNo;

            TestExceptions();
        }