Exemplo n.º 1
0
        internal Application(IntPtr raw, bool dropref)
        {
            NativeHandle = raw;
            if (dropref)
            {
                NativeMethods.event_object_unref(raw);
            }

            strongRefs = new Dictionary <IntPtr, object> ();

            NativeDependencyObjectHelper.SetManagedPeerCallbacks(this);

            get_implicit_styles    = new GetImplicitStylesCallback(get_implicit_styles_cb_safe);
            convert_setter_values  = new ConvertSetterValuesCallback(convert_setter_values_cb_safe);
            convert_keyframe_value = new ConvertKeyframeValueCallback(convert_keyframe_value_cb_safe);
            get_resource           = new GetResourceCallback(get_resource_cb_safe);

            NativeMethods.application_register_callbacks(NativeHandle, get_implicit_styles, convert_setter_values, get_resource, convert_keyframe_value);

            if (Current == null)
            {
                Current = this;

                SynchronizationContext context = new System.Windows.Threading.DispatcherSynchronizationContext();
                SynchronizationContext.SetSynchronizationContext(context);
            }
            else
            {
                root_visual = Current.root_visual;
            }

            lifetime_objects = new ApplicationLifetimeObjectsCollection();

            // once installed the default quota for isolated storage is augmented to 25MB (instead of 1MB)
            // note: this applies only to the browser (not desktop) assemblies (it won't compile otherwise)
#if !NET_3_0
            if (IsRunningOutOfBrowser)
            {
                long OutOfBrowserQuota = 25 * IsolatedStorage.DefaultQuota;
                if (IsolatedStorage.Quota < OutOfBrowserQuota)
                {
                    IsolatedStorage.Quota = OutOfBrowserQuota;
                }
            }
#endif
            var handler = UIANewApplication;
            if (handler != null)
            {
                handler(this, EventArgs.Empty);
            }
        }
Exemplo n.º 2
0
		internal Application (IntPtr raw, bool dropref)
		{
			NativeHandle = raw;
			if (dropref)
				NativeMethods.event_object_unref (raw);

			strongRefs = new Dictionary<IntPtr,object> ();

			NativeDependencyObjectHelper.SetManagedPeerCallbacks (this);

			get_default_style = new GetDefaultStyleCallback (get_default_style_cb_safe);
			convert_setter_values = new ConvertSetterValuesCallback (convert_setter_values_cb_safe);
			convert_keyframe_value = new ConvertKeyframeValueCallback (convert_keyframe_value_cb_safe);
			get_resource = new GetResourceCallback (get_resource_cb_safe);

			NativeMethods.application_register_callbacks (NativeHandle, get_default_style, convert_setter_values, get_resource, convert_keyframe_value);

			if (Current == null) {
				Current = this;

				SynchronizationContext context = new System.Windows.Threading.DispatcherSynchronizationContext ();
				SynchronizationContext.SetSynchronizationContext (context);
			} else {
				root_visual = Current.root_visual;
			}

			lifetime_objects = new ApplicationLifetimeObjectsCollection ();

			// once installed the default quota for isolated storage is augmented to 25MB (instead of 1MB)
			// note: this applies only to the browser (not desktop) assemblies (it won't compile otherwise)
#if !NET_3_0
			if (IsRunningOutOfBrowser) {
				long OutOfBrowserQuota = 25 * IsolatedStorage.DefaultQuota;
				if (IsolatedStorage.Quota < OutOfBrowserQuota)
					IsolatedStorage.Quota = OutOfBrowserQuota;
			}
#endif
			var handler = UIANewApplication;
			if (handler != null)
				handler (this, EventArgs.Empty);
		}
Exemplo n.º 3
0
		internal Application (IntPtr raw, bool dropref)
		{
			NativeHandle = raw;
			if (dropref)
				NativeMethods.event_object_unref (raw);

			strongRefs = new Dictionary<IntPtr,INativeEventObjectWrapper> ();

			NativeDependencyObjectHelper.SetManagedPeerCallbacks (this);

			get_default_style = new GetDefaultStyleCallback (get_default_style_cb_safe);
			convert_setter_values = new ConvertSetterValuesCallback (convert_setter_values_cb_safe);
			convert_keyframe_value = new ConvertKeyframeValueCallback (convert_keyframe_value_cb_safe);
			get_resource = new GetResourceCallback (get_resource_cb_safe);

			NativeMethods.application_register_callbacks (NativeHandle, get_default_style, convert_setter_values, get_resource, convert_keyframe_value);

			if (Current == null) {
				Current = this;

				SynchronizationContext context = new System.Windows.Threading.DispatcherSynchronizationContext ();
				SynchronizationContext.SetSynchronizationContext (context);
			} else {
				root_visual = Current.root_visual;
			}

			lifetime_objects = new ApplicationLifetimeObjectsCollection ();

			var handler = UIANewApplication;
			if (handler != null)
				handler (this, EventArgs.Empty);
		}