public HistoryBar( CGRect parentFrame, EventHandler onSettingsPressed )
            : base()
        {
            Layer.AnchorPoint = CGPoint.Empty;

            // setup the left label
            NSString leftLabel = new NSString( "" );

            SettingsButton = UIButton.FromType( UIButtonType.System );
            SettingsButton.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( Settings.General_IconFont, 32 );
            SettingsButton.SetTitle( leftLabel.ToString( ), UIControlState.Normal );
            SettingsButton.SetTitleColor( Theme.GetColor( Config.Instance.VisualSettings.FooterTextColor ), UIControlState.Normal );
            SettingsButton.TouchUpInside += onSettingsPressed;

            CGSize labelSize = leftLabel.StringSize( SettingsButton.Font );
            SettingsButton.Bounds = new CGRect( 0, 0, labelSize.Width, labelSize.Height );

            // create the list that will store our items
            HistoryList = new List<HistoryItem>();

            // even tho there's nothing, update it so we have our label.
            UpdateItems( );

            TintColor = UIColor.Clear;
            Translucent = false;

            BarTintColor = Theme.GetColor( Config.Instance.VisualSettings.FooterBGColor );
            Layer.Opacity = Settings.StatusBar_Opacity;

            Bounds = new CGRect( 0, 0, parentFrame.Width, Settings.StatusBar_Height );
        }
示例#2
0
        /// <summary>
        /// Callback method that Mds calls with subscription data
        /// </summary>
        /// <param name="mdsevent">Data for the subscription notification</param>
        public void OnSubscriptionEvent(Movesense.MDSEvent mdsevent)
        {
            var      data = mdsevent.BodyData;
            NSString s    = new NSString(data, NSStringEncoding.UTF8);

            Debug.WriteLine($"NOTIFICATION data = {s}");
            if (typeof(T) != typeof(String))
            {
                T result = Newtonsoft.Json.JsonConvert.DeserializeObject <T>(s);
                // Return the subscription to the awaiting caller
                mTcs.TrySetResult(Subscription);
                // Invoke the callers callback function
                mNotificationCallback?.Invoke(result);
            }
            else
            {
                // First convert NSString result to a .NET string
                String netS = string.Empty;
                netS = s?.ToString();
                // Crazy code to convert a string to a 'T' where 'T' happens to be a string
                T result = (T)((object)netS);
                // Return the subscription to the awaiting caller
                mTcs.TrySetResult(Subscription);
                // Invoke the callers callback function
                mNotificationCallback?.Invoke(result);
            }
        }
示例#3
0
        /// <summary>
        /// Callback for MDS API calls on iOS
        /// </summary>
        /// <param name="completion"></param>
        public void CallCompletionCallback(Movesense.MDSResponse completion)
        {
            if (completion.StatusCode == 200)
            {
                var      data = completion.BodyData;
                NSString s    = new NSString(data, NSStringEncoding.UTF8);

                Debug.WriteLine($"SUCCESS result = {s}");
                if (typeof(T) != typeof(String))
                {
                    T result = Newtonsoft.Json.JsonConvert.DeserializeObject <T>(s);
                    mTcs.SetResult(result);
                }
                else
                {
                    String netS = string.Empty;
                    netS = s?.ToString();
                    // Crazy code to convert a string to a 'T' where 'T' happens to be a string
                    T result = (T)((object)netS);
                    mTcs.SetResult(result);
                }
            }
            else
            {
                Debug.WriteLine($"ERROR error = {completion.Description}");
                mTcs.SetException(new MdsException(completion.Description));
            }
        }
示例#4
0
文件: Person.cs 项目: yingfangdu/BNR
 public override void SetNilValueForKey(NSString key)
 {
     if (key.ToString() == "expectedRaise")
         ExpectedRaise = 0.0f;
     else
         base.SetNilValueForKey(key);
 }
示例#5
0
		static bool NeedsDisplayForKey (NSString key)
		{
			switch (key.ToString ()) {
			case "clockColor":
				return true;
			default:
				return CALayer.NeedsDisplayForKey (key);
			}
		}
示例#6
0
		public override void ViewWillAppear (bool animated)
		{
			base.ViewWillAppear (animated);
			var path = NSBundle.MainBundle.PathForResource (HtmlFile, "html");
			using (var data = NSData.FromFile (path)) {
				var html = new NSString (data, NSStringEncoding.UTF8);
				InstructionWebView.LoadHtmlString (html.ToString (), NSBundle.MainBundle.BundleUrl);
			}
		}
示例#7
0
		public Device (CBPeripheral nativeDevice, NSString localName = null)
		{
			this._nativeDevice = nativeDevice;

			this._nativeDevice.DiscoveredService += (object sender, NSErrorEventArgs e) => {
				// why we have to do this check is beyond me. if a service has been discovered, the collection
				// shouldn't be null, but sometimes it is. le sigh, apple.
				if (this._nativeDevice.Services != null) {
					foreach (CBService s in this._nativeDevice.Services) {
						Console.WriteLine ("Device.Discovered Service: " + s.Description);
						if(!ServiceExists(s)) {
							this._services.Add (new Service(s, this._nativeDevice));
						}
					}
					this.ServicesDiscovered(this, new EventArgs());
				}
			};

			#if __UNIFIED__
			// fixed for Unified https://bugzilla.xamarin.com/show_bug.cgi?id=14893
			this._nativeDevice.DiscoveredCharacteristic += (object sender, CBServiceEventArgs e) => {
			#else
			//BUGBUG/TODO: this event is misnamed in our SDK
			this._nativeDevice.DiscoverCharacteristic += (object sender, CBServiceEventArgs e) => {
			#endif
				Console.WriteLine ("Device.Discovered Characteristics.");
				//loop through each service, and update the characteristics
				foreach (CBService srv in ((CBPeripheral)sender).Services) {
					// if the service has characteristics yet
					if(srv.Characteristics != null) {

						// locate the our new service
						foreach (var item in this.Services) {
							// if we found the service
							if (item.ID == Service.ServiceUuidToGuid(srv.UUID) ) {
								item.Characteristics.Clear();

								// add the discovered characteristics to the particular service
								foreach (var characteristic in srv.Characteristics) {
									Console.WriteLine("Characteristic: " + characteristic.Description);
									Characteristic newChar = new Characteristic(characteristic, _nativeDevice);
									item.Characteristics.Add(newChar);
								}
								// inform the service that the characteristics have been discovered
								// TODO: really, we shoul just be using a notifying collection.
								(item as Service).OnCharacteristicsDiscovered();
							}
						}
					}
				}			
			};

			_name = localName == null ? _nativeDevice.Name : localName.ToString();


		}
示例#8
0
        public RectangleF Test_RectangleF_MKCoordinateRegion_IntPtr(MKCoordinateRegion a, NSString str)
        {
            float pi = ParseString(str.ToString());

            if ((object)StringObj != (object)str)
            {
                return(RectangleF.Empty);
            }
#if __UNIFIED__
            return(new RectangleF((double)(float)a.Center.Latitude + pi, (double)(float)a.Center.Longitude - pi, (double)(float)a.Span.LatitudeDelta * pi, (double)(float)a.Span.LongitudeDelta / pi));
#else
            return(new RectangleF((float)a.Center.Latitude + pi, (float)a.Center.Longitude - pi, (float)a.Span.LatitudeDelta * pi, (float)a.Span.LongitudeDelta / pi));
#endif
        }
示例#9
0
        static bool NeedsDisplayForKey(NSString key)
        {
            switch (key.ToString())
            {
            case "timeValue":
                return(true);

            case "moneyValue":
                return(true);

            default:
                return(CALayer.NeedsDisplayForKey(key));
            }
        }
示例#10
0
        static bool NeedsDisplayForKey(NSString key)
        {
            switch (key.ToString())
            {
            case "startAngle":
                return(true);

            case "endAngle":
                return(true);

            default:
                return(CALayer.NeedsDisplayForKey(key));
            }
        }
示例#11
0
        UIBarButtonItem CreateBarButton(NSString imageName, NSString selectedImageName)
        {
            var buttonImage = UIImage.FromFile(imageName.ToString());

            var button = new UIButton(new RectangleF(0, 0, (float)buttonImage.Size.Width, (float)buttonImage.Size.Height));

            button.SetImage(buttonImage, UIControlState.Normal);
            button.SetImage(UIImage.FromFile(selectedImageName.ToString()), UIControlState.Highlighted);

            var barButton = new UIBarButtonItem(button);

            GunmetalTheme.Apply(barButton);

            return(barButton);
        }
示例#12
0
        partial void WikiButtonClick(NSObject sender)
        {
            var      term      = SearchTerm.Trim();
            var      urlString = "https://www.google.com/search?q=" + term;
            NSString stringURL = new NSString(urlString);

            stringURL = stringURL.CreateStringByAddingPercentEscapes(NSStringEncoding.UTF8);

            NSUrl url = new NSUrl(stringURL.ToString());

            if (url != null)
            {
                NSWorkspace.SharedWorkspace.OpenUrl(url);
            }
        }
示例#13
0
            public override SFMonthCell DidDrawMonthCell(SFCalendar calendar, SFMonthCell monthCell)
            {
                NSDate          now           = monthCell.Date;
                NSDateFormatter dateFormatter = new NSDateFormatter();

                dateFormatter.DateFormat = "EEEE";
                NSDateFormatter dateFormatter2 = new NSDateFormatter();

                dateFormatter2.DateFormat = "d";
                NSString day     = (NSString)dateFormatter2.ToString(now);
                NSString dayname = (NSString)dateFormatter.ToString(now);

                if (dayname.ToString().Equals("Saturday") || dayname.ToString().Equals("Sunday"))
                {
                    monthCell.TextColor = UIColor.FromRGB(9, 144, 233);
                }
                if (day.ToString().Equals("15") || day.ToString().Equals("24"))
                {
                    UIImageView view = new UIImageView();
                    view.Image     = UIImage.FromBundle("Shop-Closed.png");
                    monthCell.View = view;
                }
                return(monthCell);
            }
        private void Do_NSUrlConnection()
        {
            //NSUrlConnection urlConnection;
            //string localFilename = Path.GetTempPath() + Path.GetFileName(url);

            UIAlertView alertView = null;

            try
            {
                NSUrlResponse response   = null;
                NSError       error      = null;
                NSUrlRequest  urlRequest = new NSUrlRequest(new NSUrl(url), NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 120);
                NSData        data       = NSUrlConnection.SendSynchronousRequest(urlRequest, out response, out error);

                if (data == null)
                {
                    alertView = new UIAlertView("Error", "NSUrlConnection.SendSynchronousRequest returned null\n" + error.LocalizedDescription, null, "Ok", null);
                }
                else
                {
                    NSString dataString = NSString.FromData(data, NSStringEncoding.ASCIIStringEncoding);

                    if (dataString == null)
                    {
                        alertView = new UIAlertView("Error", "NSString.FromData returned null", null, "Ok", null);
                    }
                    else
                    {
                        alertView = new UIAlertView("Success", dataString.ToString(), null, "Ok", null);
                    }
                }
            }
            catch (Exception e)
            {
                if (alertView == null)
                {
                    alertView = new UIAlertView("Error", e.Message, null, "Ok", null);
                }

                Console.WriteLine(e.Message);
            }

            alertView.Show();


            //ProxyTest_NSUrlConnectionDelegate connectionDelegate = new ProxyTest_NSUrlConnectionDelegate();
            //urlConnection = new NSUrlConnection(DownloadRequest, connectionDelegate, true);
        }
示例#15
0
        [Export("getReportName:")]          // notice the colon at the end of the method name
        public NSString GetReportName(NSString reportName)
        {
            string _reportName = reportName.ToString();

            _reportName = _reportName.Insert(0, "\'");
            _reportName = _reportName.Insert(_reportName.Length, "\'");
            var           pendingSubmission = new List <ExpenseReport> (reportDatabase.GetReportByReportName(_reportName));
            ExpenseReport reportSaved       = pendingSubmission [0];

            if (reportSaved == null)
            {
                return(new NSString(""));
            }

            return(new NSString(reportSaved.ReportName));
        }
示例#16
0
 /// <summary>
 /// TimBarton fix 02/2016 (https://github.com/amccorma/xamarin-amccorma/issues/1)
 /// </summary>
 /// <param name="file">File.</param>
 protected internal void Load(NSString file)
 {
     // file must be set to Content
     // url starts with http
     if (String.IsNullOrEmpty(file) == false)
     {
         if (file.ToString().ToLower().StartsWith("http") == false)
         {
             this._MoviePlayer.Load(NSUrl.FromFilename(file), false);
         }
         else
         {
             this._MoviePlayer.Load(NSUrl.FromString(file), true);
         }
     }
 }
示例#17
0
        [iOS(7, 0)]         // 10.5
        public static string GetName(NSUrl url)
        {
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }

            string result = null;
            IntPtr name   = IntPtr.Zero;
            var    error  = CopyNameFromSoundBank(url.Handle, ref name);

            if (name != IntPtr.Zero)
            {
                using (NSString s = new NSString(name))
                    result = s.ToString();
            }
            return((error != 0) ? null : result);
        }
示例#18
0
        [Export("getReportExpensesCount:")]          // notice the colon at the end of the method name
        public NSString GetReportExpensesCount(NSString reportName)
        {
            string _reportName = reportName.ToString();

            _reportName = _reportName.Insert(0, "\'");
            _reportName = _reportName.Insert(_reportName.Length, "\'");
            var           pendingSubmission = new List <ExpenseReport> (reportDatabase.GetReportByReportName(_reportName));
            ExpenseReport reportSaved       = pendingSubmission [0];

            if (reportSaved == null)
            {
                return(new NSString(""));
            }

            var expenses = (List <ExpenseModel>) new MyExpensesDatabase().GetExpensesForReport(reportSaved.ExpenseReportIdentifier);

            return(new NSString(expenses.Count.ToString()));
        }
示例#19
0
        public override void Awake(NSObject context)
        {
            if (context != null)
            {
                NSString ns = (NSString)context;

                var s = ns.ToString();

                var sarr = s.Split(new [] { '@' });

                latitude  = double.Parse(sarr [0]);
                longitude = double.Parse(sarr [1]);

                this.SetTitle(sarr [2]);
            }

            base.Awake(context);
        }
示例#20
0
        public static void SetToken(NSData deviceToken)
        {
            var storage         = SimpleStorage.EditGroup("preferences");
            var lastDeviceToken = storage.Get(PropertyRegID);
            var strFormat       = new NSString("%@");
            var dt             = new NSString(Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(new Class("NSString").Handle, new Selector("stringWithFormat:").Handle, strFormat.Handle, deviceToken.Handle));
            var newDeviceToken = dt.ToString().Replace("<", "").Replace(">", "").Replace(" ", "");

            if (!newDeviceToken.Equals(lastDeviceToken))
            {
                storage.Put(PropertyRegID, newDeviceToken);
                Console.WriteLine("New Device Token saved: " + newDeviceToken);
            }
            else
            {
                Console.WriteLine("Using old token: " + lastDeviceToken);
            }
        }
示例#21
0
        public static string?GetName(NSUrl url)
        {
            if (url is null)
            {
                ObjCRuntime.ThrowHelper.ThrowArgumentNullException(nameof(url));
            }

            string?result = null;
            IntPtr name   = IntPtr.Zero;
            var    error  = CopyNameFromSoundBank(url.Handle, ref name);

            if (name != IntPtr.Zero)
            {
                using (NSString s = new NSString(name))
                    result = s.ToString();
            }
            return((error != 0) ? null : result);
        }
示例#22
0
        private Dictionary <string, string> GetInterfaceFriendlyNamesMap()
        {
            Dictionary <string, string> results = new Dictionary <string, string>();
            NSArray adapters = new Id(SCNetworkInterfaceCopyAll()).CastAs <NSArray>();

            foreach (Id adapter in adapters)
            {
                Id       bsdNameId = new Id(SCNetworkInterfaceGetBSDName(adapter.NativePointer));
                NSString bsdName   = bsdNameId.CastAs <NSString>();

                Id       displayNameId = new Id(SCNetworkInterfaceGetLocalizedDisplayName(adapter.NativePointer));
                NSString displayName   = displayNameId.CastAs <NSString>();

                results.Add(bsdName.ToString(), displayName.ToString());
            }
            adapters.Release();
            return(results);
        }
示例#23
0
        public override WKNavigation LoadHtmlString(NSString htmlString, NSUrl baseUrl)
        {
            try
            {
                if (!App.UseCustomHtmlLoad)
                {
                    return(base.LoadHtmlString(htmlString, baseUrl));
                }

                // Add additional HTML to ensure fonts scale correctly and don't appear extremely small and almost unreadable
                var iOSHtmlWithScaling = htmlString.ToString().Insert(0, "<meta name='viewport' content='width=device-width,initial-scale=1,maximum-scale=1' />");
                return(base.LoadHtmlString((NSString)iOSHtmlWithScaling, baseUrl));
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
                return(base.LoadHtmlString(htmlString, baseUrl));
            }
        }
示例#24
0
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            var supplementaryView = (MDCCollectionViewTextCell)collectionView.DequeueReusableSupplementaryView(elementKind, headerId, indexPath);

            if (elementKind.ToString() == "UICollectionElementKindSectionHeader")
            {
                if (indexPath.Section == 0)
                {
                    supplementaryView.TextLabel.Text = "Account";
                }
                else if (indexPath.Section == 1)
                {
                    supplementaryView.TextLabel.Text = "Notifocation";
                }
                supplementaryView.TextLabel.TextColor = tealColor;
            }

            return(supplementaryView);
        }
示例#25
0
        static string NSObjectToJSON(NSObject obj)
        {
            NSError err;
            NSData  jsonData = NSJsonSerialization.Serialize(obj, 0, out err);

            if (err != null)
            {
                return(string.Empty);
            }

            NSString myString = NSString.FromData(jsonData, NSStringEncoding.UTF8);

            jsonData.Dispose();

            var json = myString.ToString();

            myString.Dispose();
            return(json);
        }
示例#26
0
		public override void RegisteredForRemoteNotifications (UIApplication application, NSData deviceToken)
		{
			var oldDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken");

			//There's probably a better way to do this
		  	var strFormat = new NSString("%@");
		  	var dt = new NSString(MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(new MonoTouch.ObjCRuntime.Class("NSString").Handle, new MonoTouch.ObjCRuntime.Selector("stringWithFormat:").Handle, strFormat.Handle, deviceToken.Handle));
			var newDeviceToken = dt.ToString().Replace("<", "").Replace(">", "").Replace(" ", "");

			if (string.IsNullOrEmpty(oldDeviceToken) || !deviceToken.Equals(newDeviceToken))
			{
				//TODO: Put your own logic here to notify your server that the device token has changed/been created!
			}

			//Save device token now
			NSUserDefaults.StandardUserDefaults.SetString(newDeviceToken, "PushDeviceToken");

			Console.WriteLine("Device Token: " + newDeviceToken);
		}
示例#27
0
        public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            var oldDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken");

            //There's probably a better way to do this
            var strFormat      = new NSString("%@");
            var dt             = new NSString(MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(new MonoTouch.ObjCRuntime.Class("NSString").Handle, new MonoTouch.ObjCRuntime.Selector("stringWithFormat:").Handle, strFormat.Handle, deviceToken.Handle));
            var newDeviceToken = dt.ToString().Replace("<", "").Replace(">", "").Replace(" ", "");

            if (string.IsNullOrEmpty(oldDeviceToken) || !deviceToken.Equals(newDeviceToken))
            {
                //TODO: Put your own logic here to notify your server that the device token has changed/been created!
            }

            //Save device token now
            NSUserDefaults.StandardUserDefaults.SetString(newDeviceToken, "PushDeviceToken");

            Console.WriteLine("Device Token: " + newDeviceToken);
        }
示例#28
0
        public Car(NSCoder decoder)
        {
            NSString str = (NSString)decoder.DecodeObject("makeModel");

            if (str != null)
            {
                this.MakeModel = str.ToString();
            }

            DatePurchased = (NSDate)decoder.DecodeObject("datePurchased");

            this.Condition = decoder.DecodeInt("condition");

            this.OnSpecial = decoder.DecodeBool("onSpecial");

            this.Price = decoder.DecodeFloat("price");

            this.Photo = (NSImage)decoder.DecodeObject("photo");
        }
示例#29
0
            public override void AdjustSessionTrackingSucceeded(ADJSessionSuccess sessionSuccessResponseData)
            {
                if (!_delegateOptions.SetSessionTrackingSuccessDelegate)
                {
                    return;
                }

                Console.WriteLine(TAG + ": SesssionTrackingSucceeded, sessionSuccessResponseData = " + sessionSuccessResponseData);
                AddInfoToSendSafe("message", sessionSuccessResponseData.Message);
                AddInfoToSendSafe("timestamp", sessionSuccessResponseData.TimeStamp);
                AddInfoToSendSafe("adid", sessionSuccessResponseData.Adid);
                if (sessionSuccessResponseData.JsonResponse != null)
                {
                    NSError  error              = new NSError();
                    NSData   dataJsonResponse   = NSJsonSerialization.Serialize(sessionSuccessResponseData.JsonResponse, 0, out error);
                    NSString stringJsonResponse = new NSString(dataJsonResponse, NSStringEncoding.UTF8);
                    AddInfoToSendSafe("jsonResponse", stringJsonResponse.ToString());
                }
                _testLibrary.SendInfoToServer(_currentBasePath);
            }
        private string PlatformReadFile(string path)
        {
            if (FileExists(path))
            {
                NSFileHandle handle = NSFileHandle.OpenReadUrl(NSUrl.CreateFileUrl(new[] { path }), out NSError error);

                if (error != null)
                {
                    throw new NSErrorException(error);
                }
                else
                {
                    NSString result = NSString.FromData(handle.ReadDataToEndOfFile(), NSStringEncoding.UTF8);
                    handle.CloseFile();
                    return result?.ToString() ?? "";
                }
            }

            throw new FileNotFoundException();
        }
示例#31
0
        public void ChangeKeyPathOfObjectToValue(NSObject o)
        {
            NSString keyPath  = ((NSArray)o).GetItem <NSString>(0);
            NSObject obj      = ((NSArray)o).GetItem <NSObject>(1);
            NSObject newValue = ((NSArray)o).GetItem <NSObject>(2);

            // setValue:forKeyPath: will cause the key-value observing method
            // to be called, which takes care of the undo stuff
            if (newValue.DebugDescription != "<null>")
            {
                obj.SetValueForKeyPath(newValue, keyPath);
            }
            else
            {
                if (keyPath.ToString() == "photo")
                {
                    obj.SetValueForKeyPath(new NSImage(), keyPath);
                }
            }
        }
示例#32
0
 public override void ObserveValue(NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context)
 {
     if (keyPath.ToString() == HiddenProperty.ToString() && ofObject.Equals(ContentView))
     {
         if (ContentView.Hidden)
         {
             if (eventsEnabled.HasFlag(WindowFrameEvent.Hidden))
             {
                 OnHidden();
             }
         }
         else
         {
             if (eventsEnabled.HasFlag(WindowFrameEvent.Shown))
             {
                 OnShown();
             }
         }
     }
 }
示例#33
0
        public static string ConvertEmojiFromServer(string stringWithEmoji)
        {
            if (String.IsNullOrEmpty(stringWithEmoji))
            {
                return(String.Empty);
            }

            var tempString = stringWithEmoji;

            for (int i = tempString.Length; i != 0; tempString = tempString.Substring(0, tempString.Length - 1))
            {
                NSData   data         = NSData.FromString(tempString, NSStringEncoding.UTF8);
                NSString valueUnicode = NSString.FromData(data, NSStringEncoding.NonLossyASCII);
                if (valueUnicode != null)
                {
                    return(valueUnicode.ToString());
                }
            }
            return(stringWithEmoji);
        }
        public void ReloadData(TKAutoCompleteTextView autocomplete)
        {
            NSMutableArray suggestions = new NSMutableArray();

            if (airports == null)
            {
                NSUrl         url = new NSUrl(urlStr);
                NSUrlRequest  req = new NSUrlRequest(url);
                NSUrlResponse res;
                NSData        dataVal    = new NSData();
                NSDictionary  jsonResult = new NSDictionary();
                NSError       error;
                NSError       errorReq;
                dataVal = NSUrlConnection.SendSynchronousRequest(req, out res, out errorReq);
                if (dataVal != null)
                {
                    jsonResult = (NSDictionary)NSJsonSerialization.Deserialize(dataVal, NSJsonReadingOptions.MutableContainers, out error);
                    if (error == null)
                    {
                        airports = (NSArray)jsonResult.ObjectForKey(new NSString("airports"));
                    }


                    for (nuint i = 0; i < airports.Count; i++)
                    {
                        NSDictionary item      = airports.GetItem <NSDictionary> (i);
                        NSString     name      = (NSString)item.ValueForKey(new NSString("FIELD2"));
                        NSString     shortName = (NSString)item.ValueForKey(new NSString("FIELD5"));
                        string       result    = String.Format("{0}, {1}", name.ToString(), shortName.ToString());

                        if (result.ToUpper().StartsWith(prefix.ToUpper()))
                        {
                            suggestions.Add(new TKAutoCompleteToken(new NSString(result)));
                        }
                    }
                }

                DispatchQueue queue = DispatchQueue.MainQueue;
                queue.DispatchAfter(DispatchTime.Now, delegate { autocomplete.CompleteSuggestionViewPopulation(suggestions); });
            }
        }
示例#35
0
        public void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            // The deviceToken is what the push notification server needs to send out a notification
            // to the device. Most times application needs to send the device Token to its servers when it has changed

                        #if DEBUG
            log("Success registering for Remote Notifications");
                        #endif
            // ****** REMOVED "lastDeviceToken storage" feature. Marga 06/08/2013 . Platform will always call the JS listener; same behavior in all platforms ******

            // First, get the last device token we know of
            // string lastDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("deviceToken");

            //There's probably a better way to do this
            //NSString strFormat = new NSString("%@");
            //NSString newToken = new NSString(ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(new ObjCRuntime.Class("NSString").Handle, new ObjCRuntime.Selector("stringWithFormat:").Handle, strFormat.Handle, deviceToken.Handle));

            NSString newToken = new NSString(deviceToken.ToString());

            var newDeviceToken = newToken.ToString().Replace("<", "").Replace(">", "").Replace(" ", "");
                        #if DEBUG
            log("Device token: " + newDeviceToken);
                        #endif
            // We only want to send the device token to the server if it hasn't changed since last time
            // no need to incur extra bandwidth by sending the device token every time
            // if (!newDeviceToken.Equals(lastDeviceToken))
            //{
            // Send the new device token to your application server
            // ****** REMOVED "lastDeviceToken storage" feature. Marga 06/08/2013 . Platform will always call the JS listener; same behavior in all platforms ******

            RegistrationToken registrationToken = new RegistrationToken();
            registrationToken.StringRepresentation = newDeviceToken;
            byte[] buffer = new byte[deviceToken.Length];
            Marshal.Copy(deviceToken.Bytes, buffer, 0, buffer.Length);
            registrationToken.Binary = buffer;
            PushNotificationsUtils.FireUnityJavascriptEvent("Appverse.PushNotifications.OnRegisterForRemoteNotificationsSuccess", registrationToken);

            //Save the new device token for next application launch
            // NSUserDefaults.StandardUserDefaults.SetString(newDeviceToken, "deviceToken");
        }
示例#36
0
        public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            var oldDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken");

            //There's probably a better way to do this
            var strFormat      = new NSString("%@");
            var dt             = new NSString(MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(new MonoTouch.ObjCRuntime.Class("NSString").Handle, new MonoTouch.ObjCRuntime.Selector("stringWithFormat:").Handle, strFormat.Handle, deviceToken.Handle));
            var newDeviceToken = dt.ToString().Replace("<", "").Replace(">", "").Replace(" ", "");

            if (string.IsNullOrEmpty(oldDeviceToken) || !deviceToken.Equals(newDeviceToken))
            {
                //TODO: Put your own logic here to notify your server that the device token has changed/been created!
            }

            //Save device token now
            NSUserDefaults.StandardUserDefaults.SetString(newDeviceToken, "PushDeviceToken");

            //var wc = new WebClient();
            //registrationId="199";

            //userLogin u = controllerUserLogin.getuserLogin();

            /*
             * string myParameters = "iddev="+newDeviceToken+"&uname=iphone5Hipolyto&iduser=1024";
             * wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
             *
             * var result = wc.UploadString("http://www.letsolutions.com.mx/pushTestSpotlight/submit.aspx", "POST",myParameters);
             */
            // ParseLib.ParsePush..StoreDeviceToken (deviceToken);

            Console.WriteLine("Device Token: " + newDeviceToken);

            ParsePush.StoreDeviceToken(deviceToken);
            ParsePush.SubscribeToChannelAsync("events");


            // vtmService.registerDevice(newDeviceToken,int.Parse(u.userId));
        }
示例#37
0
文件: Car.cs 项目: yingfangdu/BNR
 public override void SetNilValueForKey(NSString key)
 {
     switch (key.ToString()) {
         case "price":
             this.Price = 0.0f;
             break;
         default:
             base.SetNilValueForKey(key);
             break;
     }
 }
示例#38
0
        /// <summary>
        /// Succcessful registration for remote notifications.
        /// </summary>
        /// <param name="application">Application.</param>
        /// <param name="deviceToken">Device token.</param>
        public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            // The deviceToken is what the push notification server needs to send out a notification
            // to the device. Most times application needs to send the device Token to its servers when it has changed

            #if DEBUG
            log ("Success registering for Remote Notifications");
            #endif
            // ****** REMOVED "lastDeviceToken storage" feature. Marga 06/08/2013 . Platform will always call the JS listener; same behavior in all platforms ******

            // First, get the last device token we know of
            // string lastDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("deviceToken");

            //There's probably a better way to do this
            NSString strFormat = new NSString("%@");
            NSString newToken = new NSString(MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(new MonoTouch.ObjCRuntime.Class("NSString").Handle, new MonoTouch.ObjCRuntime.Selector("stringWithFormat:").Handle, strFormat.Handle, deviceToken.Handle));

            var newDeviceToken = newToken.ToString().Replace("<", "").Replace(">", "").Replace(" ", "");
            #if DEBUG
            log ("Device token: " + newDeviceToken);
            #endif
            // We only want to send the device token to the server if it hasn't changed since last time
            // no need to incur extra bandwidth by sending the device token every time
            // if (!newDeviceToken.Equals(lastDeviceToken))
            //{
                // Send the new device token to your application server
                // ****** REMOVED "lastDeviceToken storage" feature. Marga 06/08/2013 . Platform will always call the JS listener; same behavior in all platforms ******

                RegitrationToken registrationToken = new RegitrationToken();
                registrationToken.StringRepresentation = newDeviceToken;
                byte[] buffer = new byte[deviceToken.Length];
                Marshal.Copy(deviceToken.Bytes, buffer,0,buffer.Length);
                registrationToken.Binary = buffer;
                IPhoneUtils.GetInstance().FireUnityJavascriptEvent("Unity.OnRegisterForRemoteNotificationsSuccess", registrationToken);

                //Save the new device token for next application launch
                // NSUserDefaults.StandardUserDefaults.SetString(newDeviceToken, "deviceToken");
            //}
        }
		protected virtual UITableViewCell NewCell(NSString cellId, NSIndexPath indexPath)
		{
			var cellStyle = UITableViewCellStyle.Default;
			var cell = new UITableViewCell(cellStyle, cellId) { };			

			var views = new List<UIView>();
			var section = Sections[indexPath.Section];
		
			var key = cellId.ToString();

			if (section.ViewTypes != null && section.ViewTypes.ContainsKey(key))
			{
				var viewTypes = section.ViewTypes[key];
				if (viewTypes != null)
				{
					var memberData = GetMemberData(indexPath);

					foreach (var viewType in viewTypes)
					{
						UIView view = null;
						var hasFrameCtor = viewType.GetConstructor(new Type[] { typeof(RectangleF) }) != null;
						if (hasFrameCtor)
							view = Activator.CreateInstance(viewType, new object[] { cell.ContentView.Bounds }) as UIView;
						else
							view = Activator.CreateInstance(viewType) as UIView;

						var memberAttributes = memberData.Member.GetCustomAttributes(false);
						
						foreach (var memberAttribute in memberAttributes)
						{
							var hasCellViewTemplate = view as ICellViewTemplate;
							var cellViewTemplate = memberAttribute as CellViewTemplate;
							if (hasCellViewTemplate != null && cellViewTemplate != null && hasCellViewTemplate.GetType() == cellViewTemplate.CellViewType)
							{
								hasCellViewTemplate.CellViewTemplate = cellViewTemplate;
							}

							var viewTheme = view as IThemeable;
							if (viewTheme != null)
							{
								var memberTheme = memberAttribute as CellViewTemplate;
								if (memberTheme != null && memberTheme.Theme != null)
								{
									viewTheme.Theme = Theme.CreateTheme(memberTheme.Theme);
								}
							}

							var navigable = view as INavigable;
							if (navigable != null)
							{
								var memberNavigable = memberAttribute as INavigable;
								if (memberNavigable != null)
								{
									navigable.NavigateToViewType = memberNavigable.NavigateToViewType;
									navigable.IsModal = memberNavigable.IsModal;
									navigable.TransitionStyle = memberNavigable.TransitionStyle;
								}
							}

							var caption = view as ICaption;
							if (caption != null)
							{
								var memberCaption = memberAttribute as ICaption;
								if (memberCaption != null && !string.IsNullOrEmpty(memberCaption.Caption))
								{
									caption.Caption = memberCaption.Caption;
								}
							}
						}

						var commandButton = view as ICommandButton;
						if (commandButton != null && !string.IsNullOrEmpty(commandButton.CommandMemberName))
						{
							var commandMember = GetMemberFromView(commandButton.CommandMemberName);
							if (commandMember != null)
							{
								commandButton.Command = commandMember.GetValue(memberData.Source) as ICommand;
							}
						}

						var dc = view as IDataContext<MemberData>;
						if (dc != null)
						{
							dc.DataContext = memberData;
						}

						var initializeCell = view as IInitializeCell;
						if (initializeCell != null)
						{
							var newCellStyle = initializeCell.CellStyle;
							if (newCellStyle != cellStyle)
							{
								// recreate cell with new style
								cell = new UITableViewCell(newCellStyle, cellId) { };
							}
	
							initializeCell.Cell = cell;
							initializeCell.Controller = Controller;
						}
						
						var themeable = view as IThemeable;
						if (themeable != null)
						{
							var theme = Theme.CreateTheme(Controller.Theme);

							var themeAttribute = viewType.GetCustomAttribute<ThemeAttribute>();
							if (themeAttribute != null)
							{
								var viewTypeTheme = Theme.CreateTheme(themeAttribute.ThemeType);
								theme.MergeTheme(viewTypeTheme);
							}

							themeAttribute = memberData.Member.GetCustomAttribute<ThemeAttribute>();
							if (themeAttribute != null)
							{
								var memberTheme = Theme.CreateTheme(themeAttribute.ThemeType);
								theme.MergeTheme(memberTheme);
							}

							themeable.Theme = theme;
							themeable.Theme.Cell = cell;
						}

						var initalizable = view as IInitializable;
						if (initalizable != null)
						{
							initalizable.Initialize();
						}
						
						views.Add(view);
					}
				}
			}
			
			cell.TextLabel.Text = Caption;
			cell.TextLabel.BackgroundColor = UIColor.Clear;
			
			if (cell.DetailTextLabel != null)
			{
				cell.DetailTextLabel.BackgroundColor = UIColor.Clear;
			}
			
			var selectable = this as ISelectable;
			cell.SelectionStyle = selectable != null ? UITableViewCellSelectionStyle.Blue : UITableViewCellSelectionStyle.Blue;
			
			if (views.Count > 0)
			{
				cell.ContentView.AutosizesSubviews = true;
			}

			section.Views.Add(cell, views);
			var resizedRows = false;
			
			foreach (var view in views)
			{
				var accessoryView = view as IAccessoryView;
				if (accessoryView != null)
				{
					view.Tag = 1;
					view.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleLeftMargin;
					cell.AccessoryView = view;
				}
				else
				{
					var contentView = view as ICellContent;
					if (contentView != null)
					{
						view.Tag = 1;
						view.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleLeftMargin;
						cell.ContentView.Add(view);
					}
				}
				
				var sizeable = view as ISizeable;
				if (sizeable != null)
				{
					var rowHeight = sizeable.GetRowHeight();

					if (RowHeights.ContainsKey(indexPath))
					{
						if (RowHeights[indexPath] != rowHeight)
						{
							RowHeights[indexPath] = rowHeight;
							resizedRows = true;
						}
					}
					else
					{
						RowHeights.Add(indexPath, rowHeight);
						resizedRows = true;
					}
				}
			}

			if (resizedRows)
			{
				new Wait(TimeSpan.FromMilliseconds(0), () =>
				{
					Controller.TableView.BeginUpdates();
					Controller.TableView.EndUpdates();
				});
			}

			return cell;
		}
示例#40
0
		private UITableViewCell NewListCell(NSString cellId, NSIndexPath indexPath)
		{
			var cellStyle = UITableViewCellStyle.Subtitle;		

			var section = Sections[indexPath.Section];
		
			IList<Type> viewTypes = null;

			var key = cellId.ToString();

			if (section.ViewTypes != null && section.ViewTypes.ContainsKey(key))
			{
				viewTypes = section.ViewTypes[key];
				if (viewTypes != null && !viewTypes.Contains(NavigationViewType))
				{
					viewTypes.Add(NavigationViewType);
				}
			}

			if (viewTypes == null && NavigationViewType != null)
			{
				viewTypes = new List<Type>() { NavigationViewType };
			}
 
			var cell = new ComposableViewListCell(cellStyle, cellId, indexPath, viewTypes, this);
			//If we have a new cell Style then we need to recreate the cell. 
			if (cellStyle != cell.Style)
				cell = new ComposableViewListCell(cell.Style, cellId, indexPath, viewTypes, this);

			return cell;
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // First setup the SpringboardReveal button, which rests in the upper left
            // of the MainNavigationUI. (We must do it here because the ContainerViewController's
            // NavBar is the active one.)
            NSString buttonLabel = new NSString( "" );

            HomeButton = new UIButton(UIButtonType.System);
            HomeButton.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( "Bh", 36 );
            HomeButton.SetTitle( buttonLabel.ToString( ), UIControlState.Normal );
            HomeButton.SetTitleColor( Theme.GetColor( Config.Instance.VisualSettings.TopHeaderTextColor ), UIControlState.Normal );
            HomeButton.SetTitleColor( UIColor.DarkGray, UIControlState.Disabled );

            // determine its dimensions
            CGSize buttonSize = buttonLabel.StringSize( HomeButton.Font );
            HomeButton.Bounds = new CGRect( 0, 0, buttonSize.Width, buttonSize.Height );

            // set its callback
            HomeButton.TouchUpInside += (object sender, EventArgs e) =>
                {
                    // clear any current family VC
                    CurrentFamilyInfoViewController = null;

                    // reset our stack
                    SubNavigationController.PopToRootViewController( true );
                    SubNavigationController.View.SetNeedsLayout( );

                    // turn off the home button
                    HomeButton.Enabled = false;

                    // and enable the add family button
                    AddFamilyButton.Enabled = true;
                };

            // set the "Add Family" button
            buttonLabel = new NSString( "" );

            AddFamilyButton = new UIButton(UIButtonType.System);
            AddFamilyButton.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( "Bh", 36 );
            AddFamilyButton.SetTitle( buttonLabel.ToString( ), UIControlState.Normal );
            AddFamilyButton.SetTitleColor( Theme.GetColor( Config.Instance.VisualSettings.TopHeaderTextColor ), UIControlState.Normal );
            AddFamilyButton.SetTitleColor( UIColor.DarkGray, UIControlState.Disabled );

            // determine its dimensions
            buttonSize = buttonLabel.StringSize( HomeButton.Font );
            AddFamilyButton.Bounds = new CGRect( 0, 0, buttonSize.Width, buttonSize.Height );

            // set its callback
            AddFamilyButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                // clear any current family VC
                CurrentFamilyInfoViewController = null;

                // and present a new family page
                PresentNewFamilyPage( );
            };

            UIBarButtonItem[] leftItems = new UIBarButtonItem[]
            {
                new UIBarButtonItem( HomeButton ),
                new UIBarButtonItem( AddFamilyButton )
            };
            this.NavigationItem.SetLeftBarButtonItems( leftItems, false );

            CreateSubNavigationController( );

            SearchFamiliesViewController = new SearchFamiliesViewController( this );
            SubNavigationController.PushViewController( SearchFamiliesViewController, true );

            HomeButton.Enabled = false;

            SettingsViewController = new SettingsViewController( this );

            // set our theme
            CoreViewController.ApplyTheme( this );
        }
示例#42
0
 public void InsertText(NSString input)
 {
     // Set the letter pressed on key down
     this.Letter = input.ToString();
     if (tutorController != null && tutorController.Timer != null) {
         if (tutorController.outLetterView.Letter == this.Letter) {
             SetValueForKey(NSColor.Green, new NSString("BgColor"));
             tutorController.CorrectLetters++;
             tutorController.lblCorrect.StringValue = tutorController.CorrectLetters.ToString();
         }
         else {
             SetValueForKey(NSColor.Red, new NSString("BgColor"));
             tutorController.IncorrectLetters++;
             tutorController.lblIncorrect.StringValue = tutorController.IncorrectLetters.ToString();
         }
     //				tutorController.colorTextField.Enabled = false;
     //				tutorController.colorWell.Enabled = false;
         tutorController.keyPressedFlag = true;
     }
 }
		static bool NeedsDisplayForKey (NSString key)
		{
			switch (key.ToString ()) {
			case "radius":
			case "thickness":
			case "circleColor":
				return true;
			default:
				return CALayer.NeedsDisplayForKey (key);
			}
		}
 static bool NeedsDisplayForKey(NSString key)
 {
     if (key.ToString () == "progress")
         return true;
     else
         return CALayer.NeedsDisplayForKey (key);
 }
示例#45
0
 public NSString concat(NSString lhs, NSString rhs)
 {
     return NSString.Create(lhs.ToString() + rhs.ToString());
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // container view must have a black background so that the ticks
            // before the task displays don't cause a flash
            View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor );
            View.Layer.AnchorPoint = CGPoint.Empty;
            View.Layer.Position = CGPoint.Empty;

            // First setup the SpringboardReveal button, which rests in the upper left
            // of the MainNavigationUI. (We must do it here because the ContainerViewController's
            // NavBar is the active one.)
            NSString buttonLabel = new NSString(PrivatePrimaryNavBarConfig.RevealButton_Text);

            SpringboardRevealButton = new UIButton(UIButtonType.System);
            SpringboardRevealButton.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary, PrivatePrimaryNavBarConfig.RevealButton_Size );
            SpringboardRevealButton.SetTitle( buttonLabel.ToString( ), UIControlState.Normal );

            // determine its dimensions
            CGSize buttonSize = buttonLabel.StringSize( SpringboardRevealButton.Font );
            SpringboardRevealButton.Bounds = new CGRect( 0, 0, buttonSize.Width, buttonSize.Height );

            // set its callback
            SpringboardRevealButton.TouchUpInside += (object sender, EventArgs e) => 
                {
                    (ParentViewController as MainUINavigationController).SpringboardRevealButtonTouchUp( );
                };
            this.NavigationItem.SetLeftBarButtonItem( new UIBarButtonItem( SpringboardRevealButton ), false );
            //

            // set the title image for the bar
            string imagePath = NSBundle.MainBundle.BundlePath + "/" + PrivatePrimaryNavBarConfig.LogoFile_iOS;
            UIImage titleImage = new UIImage( imagePath );
            this.NavigationItem.TitleView = new UIImageView( titleImage );
            this.NavigationItem.TitleView.SizeToFit( );

            nfloat delta = (NavigationController.NavigationBar.Bounds.Height - titleImage.Size.Height) / 2;
            NavigationController.NavigationBar.SetTitleVerticalPositionAdjustment( -delta, UIBarMetrics.Default );

            // Now create the sub-navigation, which includes
            // the NavToolbar used to let the user navigate
            CreateSubNavigationController( );
        }
		private void observeValueForKeyPath(NSString keyPath, NSArrayController ofObject, NSDictionary change, IntPtr context)
		{
			Console.Write(String.Format("Table selection changed: keyPath = {0} : ",
			                                keyPath.ToString()));
			for(uint idx = 0; idx < ofObject.SelectionIndexes.Count; idx++)
			{
				Console.Write(ofObject.SelectionIndexes.IndexGreaterThanOrEqual(idx) + " ");
			}
			Console.WriteLine();
		}
        void Initialize()
        {
            log ("Initialize view");
            this.ShowSplashScreenOnStartupTime( UIApplication.SharedApplication.StatusBarOrientation);

            NSObject supportedOrientationsObj = NSBundle.MainBundle.ObjectForInfoDictionary ("CustomUISupportedInterfaceOrientations");
            if (supportedOrientationsObj != null) {
                if (supportedOrientationsObj is NSArray) {
                    supportedOrientations = (NSArray)supportedOrientationsObj;

                    for (uint index = 0; index < supportedOrientations.Count; index++) {
                        NSString mySupportedOrientation = new NSString (supportedOrientations.ValueAt (index));
                        if (("UIInterfaceOrientation" + UIInterfaceOrientation.Portrait.ToString ()) == mySupportedOrientation.ToString ()) {
                            orientationSupportedPortrait = true;
                        }
                        if (("UIInterfaceOrientation" + UIInterfaceOrientation.PortraitUpsideDown.ToString ()) == mySupportedOrientation.ToString ()) {
                            orientationSupportedPortraitUpsideDown = true;
                        }
                        if (("UIInterfaceOrientation" + UIInterfaceOrientation.LandscapeLeft.ToString ()) == mySupportedOrientation.ToString ()) {
                            orientationSupportedLandscapeLeft = true;
                        }
                        if (("UIInterfaceOrientation" + UIInterfaceOrientation.LandscapeRight.ToString ()) == mySupportedOrientation.ToString ()) {
                            orientationSupportedLandscapeRight = true;
                        }
                    }

                }
            }
        }
        /// DEPRECATED for iOS 6 and later, but needed for iOS 5 and earlier to support additional orientations
        public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
        {
            bool shouldAutorotate = IPhoneUtils.GetInstance ().ShouldAutorotate ();

            if (shouldAutorotate) {
                // Check supported orientations
                if (supportedOrientations != null) {
                    bool orientationSupported = false;
                    for (uint index = 0; index < supportedOrientations.Count; index++) {
                        NSString mySupportedOrientation = new NSString (supportedOrientations.ValueAt (index));
                        if (("UIInterfaceOrientation" + toInterfaceOrientation.ToString ()) == mySupportedOrientation.ToString ()) {
                            orientationSupported = true;
                            break;
                        }
                    }
                    shouldAutorotate = orientationSupported;
                } else {
                    log ("Supported orientations not configured. All orientations are supported by default");
                }
            } else {
                log (" ** Autorotation blocked by application at runtime. ");
            }

            log ("Should Autorotate to " + toInterfaceOrientation.ToString () + "? " + shouldAutorotate);

            if(shouldAutorotate) this.ShowSplashScreenOnStartupTime(toInterfaceOrientation);

            return shouldAutorotate;
        }
        void UpdateNavBarRightButtons( )
        {
            // First setup the campus button, which rests in the upper right
            // of the MainNavigationUI. (We must do it here because the ContainerViewController's
            // NavBar is the active one.)
            NSString buttonLabel = new NSString( Config.Instance.Campuses[ Config.Instance.SelectedCampusIndex ].Name );

            UIButton campusButton = new UIButton(UIButtonType.System);
            campusButton.SetTitle( buttonLabel.ToString( ), UIControlState.Normal );
            campusButton.SetTitleColor( Theme.GetColor( Config.Instance.VisualSettings.TopHeaderTextColor ), UIControlState.Normal );

            // determine its dimensions
            CGSize buttonSize = buttonLabel.StringSize( campusButton.Font );
            campusButton.Bounds = new CGRect( 0, 0, buttonSize.Width, buttonSize.Height );

            // set its callback
            campusButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                //Console.WriteLine( "Tapped!" );
            };

            // add a Logout button as well
            buttonLabel = new NSString( "" );

            UIButton logoutButton = new UIButton(UIButtonType.System);
            logoutButton.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( "Bh", 36 );
            logoutButton.SetTitle( buttonLabel.ToString( ), UIControlState.Normal );
            logoutButton.SetTitleColor( Theme.GetColor( Config.Instance.VisualSettings.TopHeaderTextColor ), UIControlState.Normal );

            // determine its dimensions
            buttonSize = buttonLabel.StringSize( HomeButton.Font );
            logoutButton.Bounds = new CGRect( 0, 0, buttonSize.Width, buttonSize.Height );

            // set its callback
            logoutButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                UIAlertController actionSheet = UIAlertController.Create( Strings.General_Logout,
                    Strings.General_ConfirmLogout,
                    UIAlertControllerStyle.Alert );

                UIAlertAction yesAction = UIAlertAction.Create( Strings.General_Yes, UIAlertActionStyle.Default, delegate(UIAlertAction obj)
                    {
                        Parent.DisplayLoginScreen( true );
                    } );

                //setup cancel
                UIAlertAction cancelAction = UIAlertAction.Create( Strings.General_No, UIAlertActionStyle.Default, delegate
                    {

                    } );

                actionSheet.AddAction( yesAction );
                actionSheet.AddAction( cancelAction );

                PresentViewController( actionSheet, true, null );
            };

            this.NavigationItem.SetRightBarButtonItems( new UIBarButtonItem[] { new UIBarButtonItem( logoutButton ), new UIBarButtonItem( campusButton ) }, false );
            //
        }
示例#51
0
		public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
		{


			//var contentavail = ((NSDictionary)userInfo.ObjectForKey(NSObject.FromObject("aps"))).ObjectForKey(NSObject.FromObject("content-available"));

			//Console.WriteLine("got push notificaion: " + userInfo);
			ViewUtils.AddDotToTabBarAtIndex(1);

			if (TabBarController != null && application.ApplicationState == UIApplicationState.Inactive)
			{
				TabBarController.SelectedIndex = 1;
				NSDictionary notificationDict = (NSDictionary)userInfo.ObjectForKey(NSObject.FromObject("notification"));

				NSError err;
				NSData jsonData = NSJsonSerialization.Serialize(notificationDict, NSJsonWritingOptions.PrettyPrinted, out err);


				NSString myString = new NSString(jsonData, NSStringEncoding.UTF8);
				Notification notification = Newtonsoft.Json.JsonConvert.DeserializeObject<Notification>(myString.ToString());

				if (
					notification.type == Strings.notification_type_like ||
					notification.type == Strings.notification_type_mention_comment ||
					notification.type == Strings.notification_type_mention_post ||
					notification.type == Strings.notification_type_comment ||
					notification.type == Strings.notification_type_repost
				   )
				{
					TenServiceHelper.GoToSinglePost(notification.post);
				}
				else if (
				  notification.type == Strings.notification_type_following ||
				  notification.type == Strings.notification_type_follow
			  		)
				{
					TenServiceHelper.GoToGuestProfile(notification.user);
				}

			}

			completionHandler(UIBackgroundFetchResult.NewData);
		}
示例#52
0
 static bool NeedsDisplayForKey (NSString key)
 {
     switch (key.ToString ()) {
     case "startAngle":
         return true;
     case "endAngle":
         return true;
     default:
         return CALayer.NeedsDisplayForKey (key);
     }
 }
示例#53
0
        /// <summary>
        /// The iOS will call the APNS in the background and issue a device token to the device. when that's 
        /// accomplished, this method will be called.
        /// 
        /// Note: the device token can change, so this needs to register with your server application everytime 
        /// this method is invoked, or at a minimum, cache the last token and check for a change.
        /// </summary>
        public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            //The deviceToken is of interest here, this is what your push notification server needs to send out a notification
            // to the device.  So, most times you'd want to send the device Token to your servers when it has changed

            //First, get the last device token we know of
            string lastDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("deviceToken");

            //There's probably a better way to do this
            NSString strFormat = new NSString("%@");
            NSString newDeviceToken = new NSString(MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(new MonoTouch.ObjCRuntime.Class("NSString").Handle, new MonoTouch.ObjCRuntime.Selector("stringWithFormat:").Handle, strFormat.Handle, deviceToken.Handle));

            //We only want to send the device token to the server if it hasn't changed since last time
            // no need to incur extra bandwidth by sending the device token every time
            if (!newDeviceToken.ToString().Equals(lastDeviceToken))
            {
                RedBit.CCAdmin.LoginManager.Default.AcquirePushChannel (newDeviceToken);

                //Save the new device token for next application launch
                NSUserDefaults.StandardUserDefaults.SetString(newDeviceToken, "deviceToken");
            }
        }
		UIBarButtonItem CreateBarButton (NSString imageName, NSString selectedImageName)
		{
			var buttonImage = UIImage.FromFile (imageName.ToString ());
			
			var button = new UIButton (new RectangleF (0, 0, buttonImage.Size.Width, buttonImage.Size.Height));

			button.SetImage (buttonImage, UIControlState.Normal);
			button.SetImage (UIImage.FromFile (selectedImageName.ToString ()), UIControlState.Highlighted);

			var barButton = new UIBarButtonItem (button);
			GunmetalTheme.Apply (barButton);

			return barButton;
		}
示例#55
0
        [Export ("UITestBackdoorScan:")] // notice the colon at the end of the method name
        public NSString UITestBackdoorScan (NSString value)
        {
            homeViewController.UITestBackdoorScan (value.ToString ());

            return new NSString ();
        }
示例#56
0
        public new NSString windowTitleForDocumentDisplayName(NSString displayName)
        {
            NSString result = displayName;

            if (Path != null)
            {
                var defaults = NSUserDefaults.standardUserDefaults();
                if (defaults.boolForKey(NSString.Create("reverse window paths")))
                {
                    result = NSString.Create(Path.ReversePath());
                }
            }

            if (m_boss.Has<IDocumentWindowTitle>())
            {
                var title = m_boss.Get<IDocumentWindowTitle>();
                result = NSString.Create(title.GetTitle(displayName.ToString()));
            }

            return result;
        }
示例#57
0
        private void DoSetCommonOptions(ProcessStartInfo info, NSString uses, NSString args, NSString env, NSString workingDir)
        {
            if (!NSObject.IsNullOrNil(args))
                info.Arguments = string.Format("--debug {0} {1:D}", m_exe, args);	// note that the exe should not be the first arg (NSApplication can get confused if so)
            else
                info.Arguments = string.Format("--debug {0}", m_exe);

            info.FileName = NSObject.IsNullOrNil(uses) ? "mono" : uses.ToString();
            info.RedirectStandardInput = false;
            info.RedirectStandardOutput = true;
            info.RedirectStandardError = true;
            info.UseShellExecute = false;
            if (!NSObject.IsNullOrNil(workingDir))
                info.WorkingDirectory = workingDir.ToString();
            else
                info.WorkingDirectory = m_exeDir;	// this case is used only when debugging via AppleScript with no using parameter

            if (!NSObject.IsNullOrNil(env))
            {
                // When running an app via a shell the app will get all the environment variables exported
                // from that shell (e.g. those set in .bash_profile). When running via the Finder only a few
                // variables are exported (and none from .bash_profile).
                //
                // When running an app via Continuum (with or without the debugger) the app will default
                // to the variables Continnuum was started up with, which depends upon whether Continuum
                // was started via the Finder.
                foreach (string entry in env.ToString().Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries))
                {
                    int i = entry.IndexOf('=');
                    if (i < 0)
                        throw new Exception("Expected an '=' in " + entry);

                    // Environment variables set by the user override existing variables.
                    info.EnvironmentVariables[entry.Substring(0, i)] = entry.Substring(i + 1);
                }
            }
        }
		UIBarButtonItem CreateBarButton (NSString imageName, NSString selectedImageName, Selector selector)
		{
			var buttonImage = UIImage.FromFile (imageName.ToString ());
			
			var button = new UIButton (new RectangleF (0, 0, (float)buttonImage.Size.Width, (float)buttonImage.Size.Height));

			button.SetImage (buttonImage, UIControlState.Normal);
			button.SetImage (UIImage.FromFile (selectedImageName.ToString ()), UIControlState.Highlighted);
			button.AddTarget (this, selector, UIControlEvent.TouchUpInside);
			
			var barButton = new UIBarButtonItem (button);
			GunmetalTheme.Apply (barButton);
			
			return barButton;
		}
示例#59
0
 public bool ObjectValue(out NSObject obj, NSString str, IntPtr errorDescription)
 {
     string errorDescriptionString = String.Format("\"{0}\" does not match any color", str);
     obj = null;
     // Look up the color for the string
     string matchingKey = FirstColorKeyForPartialString(str.ToString());
     if (matchingKey != null) {
         obj = colorList.ColorWithKey(matchingKey);
         return true;
     }
     else {
         if (errorDescription != IntPtr.Zero) {
             NSString errorDescriptionObj = new NSString (errorDescriptionString);
             Marshal.WriteIntPtr(errorDescription, errorDescriptionObj.Handle);
         }
         return false;
     }
 }
        public override void ObserveValue(NSString keyPath, NSObject ofObject, NSDictionary change, IntPtr context)
        {
            //base.ObserveValue(keyPath, ofObject, change, context);
            if (keyPath.ToString().ToLower() == "contentInset".ToLower())
            {
                if (!_ignoreInset)
                {
                    this.originalContentInset = (change["new"] as NSValue).UIEdgeInsetsValue;
                    this.Frame = new RectangleF(0, -1 * (kTotalViewHeight + this.scrollView.ContentInset.Top), this.scrollView.Frame.Size.Width, kTotalViewHeight);
                }
                return;
            }

            if (!this.Enabled || this._ignoreOffset)
                return;

            float offset = (change["new"] as NSValue).PointFValue.Y + this.originalContentInset.Top;

            if (_refreshing)
            {
                if (offset != 0)
                {
                    // keep thing pinned at the top
                    CATransaction.Begin();
                    CATransaction.SetValueForKey(NSNumber.FromBoolean(true), CATransaction.DisableActionsKey);
                    _shapeLayer.Position = new PointF(0, kMaxDistance + offset + kOpenedViewHeight);
                    CATransaction.Commit();

                    this.activity.Center = new PointF((float)Math.Floor(this.Frame.Size.Width / 2), (float)Math.Min(offset + this.Frame.Size.Height + Math.Floor(kOpenedViewHeight / 2), this.Frame.Size.Height - kOpenedViewHeight / 2));

                    _ignoreInset = true;
                    _ignoreOffset = true;

                    if (offset < 0)
                    {
                        // set the inset depending on the situation
                        if (offset >= kOpenedViewHeight * -1)
                        {
                            if (!this.scrollView.Dragging)
                            {
                                if (!_didSetInset)
                                {
                                    _didSetInset = true;
                                    _hasSectionHeaders = false;
                                    if (this.scrollView is UITableView)
                                    {
                                        for (int i = 0; i < (this.scrollView as UITableView).NumberOfSections(); ++i)
                                        {
                                            if ((this.scrollView as UITableView).RectForHeaderInSection(i).Size.Height != 0)
                                            {
                                                _hasSectionHeaders = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                if (_hasSectionHeaders)
                                    this.scrollView.ContentInset = new UIEdgeInsets(Math.Min(offset * -1, kOpenedViewHeight) + this.originalContentInset.Top, this.originalContentInset.Left, this.originalContentInset.Bottom, this.originalContentInset.Right);
                                else
                                    this.scrollView.ContentInset = new UIEdgeInsets(kOpenedViewHeight + this.originalContentInset.Top, this.originalContentInset.Left, this.originalContentInset.Bottom, this.originalContentInset.Right);
                            }
                            else if(_didSetInset && _hasSectionHeaders)
                            {
                                this.scrollView.ContentInset = new UIEdgeInsets(-1 * offset + this.originalContentInset.Top, this.originalContentInset.Left, this.originalContentInset.Bottom, this.originalContentInset.Right);
                            }
                        }
                    }
                    else if (_hasSectionHeaders)
                    {
                        this.scrollView.ContentInset = this.originalContentInset;
                    }
                    _ignoreInset = false;
                    _ignoreOffset = false;
                }
                return;
            }
            else
            {
                // check if we can trigger a new refresh and if we can draw the control
                bool dontDraw = false;  // line 230
                if (!_canRefresh)
                {
                    if (offset >= 0)
                    {
                        // we can refresh again after the control is scrolled out of view
                        _canRefresh = true;
                        _didSetInset = false;
                    }
                    else
                    {
                        dontDraw = true;
                    }
                }
                else
                {
                    if (offset >= 0)
                    {
                        // don't draw if the control is not visible
                        dontDraw = true;
                    }
                }
                if (offset > 0 && _lastOffset > offset  && !this.scrollView.Tracking)
                {
                    // if we are scrolling too fast, don't draw, and don't trigger unless the scrollView bounced back

                    // removed behavior Heath
                    //_canRefresh = false;
                    //dontDraw = true;
                }
                if (dontDraw)
                {
                    _shapeLayer.Path = null;
                    _shapeLayer.ShadowPath = new CGPath(IntPtr.Zero);
                    _arrowLayer.Path = null;
                    _highlightLayer.Path = null;
                    _lastOffset = offset;
                    return;
                }
            }

            _lastOffset = offset;  // line 260

            bool triggered = false;

            CGPath path = new CGPath();

            // calculate some useful points and values
            float verticalShift = (float)Math.Max(0, -1 * ((kMaxTopRadius + kMaxBottomRadius + kMaxTopPadding + kMaxBottomPadding) + offset));
            float distance = (float)Math.Min(kMaxDistance, (float)Math.Abs(verticalShift));
            float percentage = 1 - (distance / kMaxDistance);

            float currentTopPadding = lerp(kMinTopPadding, kMaxTopPadding, percentage);
            float currentTopRadius = lerp(kMinTopRadius, kMaxTopRadius, percentage);
            float currentBottomRadius = lerp(kMinBottomRadius, kMaxBottomRadius, percentage);
            float currentBottomPadding = lerp(kMinBottomPadding, kMaxBottomPadding, percentage);

            PointF bottomOrigin = new PointF((float)Math.Floor(this.Bounds.Size.Width / 2), this.Bounds.Size.Height - currentBottomPadding - currentBottomRadius);
            PointF topOrigin = PointF.Empty;
            if (distance == 0)
            {
                topOrigin = new PointF((float)Math.Floor(this.Bounds.Size.Width / 2), bottomOrigin.Y);
            }
            else
            {
                topOrigin = new PointF((float)Math.Floor(this.Bounds.Size.Width / 2), this.Bounds.Size.Height + offset + currentTopPadding + currentTopRadius);
                if (percentage == 0)
                {
                    bottomOrigin.Y -= (float)Math.Abs(verticalShift) - kMaxDistance;
                    triggered = true;
                }
            }

            // top semicircle
            path.AddArc(topOrigin.X, topOrigin.Y, currentTopRadius, 0, (float)Math.PI, true);

            // left curve
            PointF leftCp1 = new PointF(lerp((topOrigin.X - currentTopRadius), (bottomOrigin.X - currentBottomRadius), 0.1f), lerp(topOrigin.Y, bottomOrigin.Y, 0.2f));
            PointF leftCp2 = new PointF(lerp((topOrigin.X - currentTopRadius), (bottomOrigin.X - currentBottomRadius), 0.9f), lerp(topOrigin.Y, bottomOrigin.Y, 0.2f));
            PointF leftDestination = new PointF(bottomOrigin.X - currentBottomRadius, bottomOrigin.Y);

            path.AddCurveToPoint(leftCp1, leftCp2, leftDestination);

            // bottom semicircle
            path.AddArc(bottomOrigin.X, bottomOrigin.Y, currentBottomRadius, (float)Math.PI, 0, true);

            // right curve
            PointF rightCp2 = new PointF(lerp((topOrigin.X + currentTopRadius), (bottomOrigin.X + currentBottomRadius), 0.1f), lerp(topOrigin.Y, bottomOrigin.Y, 0.2f));
            PointF rightCp1 = new PointF(lerp((topOrigin.X + currentTopRadius), (bottomOrigin.X + currentBottomRadius), 0.9f), lerp(topOrigin.Y, bottomOrigin.Y, 0.2f));
            PointF rightDestination = new PointF(bottomOrigin.X + currentTopRadius, topOrigin.Y);

            path.AddCurveToPoint (rightCp1, rightCp2, rightDestination);
            path.CloseSubpath();

            if (!triggered) // line 309
            {
                // set paths
                _shapeLayer.Path = path;
                _shapeLayer.ShadowPath = path;

                // add the arrow shape
                float currentArrowSize = lerp(kMinArrowSize, kMaxArrowSize, percentage);
                float currentArrowRadius = lerp(kMinArrowRadius, kMaxArrowRadius, percentage);
                float arrowBigRadius = currentArrowRadius + (currentArrowSize / 2);
                float arrowSmallRadius = currentArrowRadius - (currentArrowSize / 2);
                CGPath arrowPath = new CGPath();
                /*
                arrowPath.AddArc(topOrigin.X, topOrigin.Y, arrowBigRadius, 0, 3 * (float)Math.PI, false);
                arrowPath.AddLineToPoint(topOrigin.X, topOrigin.Y - arrowBigRadius - currentArrowSize);
                arrowPath.AddLineToPoint(topOrigin.X + (2 * currentArrowSize), topOrigin.Y - arrowBigRadius + (currentArrowSize / 2));
                arrowPath.AddLineToPoint(topOrigin.X, topOrigin.Y - arrowBigRadius + (2 * currentArrowSize));
                arrowPath.AddLineToPoint(topOrigin.X, topOrigin.Y - arrowBigRadius + currentArrowSize);
                arrowPath.AddArc(topOrigin.X, topOrigin.Y, arrowSmallRadius, 3 * (float)Math.PI, 0, true);
                */
                arrowPath.AddArc (topOrigin.X, topOrigin.Y, arrowBigRadius, 0, 3 * (float) Math.PI / 2.0f, false);
                arrowPath.AddLineToPoint (topOrigin.X, topOrigin.Y - arrowBigRadius - currentArrowSize);
                arrowPath.AddLineToPoint (topOrigin.X + (2 * currentArrowSize), topOrigin.Y - arrowBigRadius + (currentArrowSize / 2.0f));
                arrowPath.AddLineToPoint (topOrigin.X, topOrigin.Y - arrowBigRadius + (2 * currentArrowSize));
                arrowPath.AddLineToPoint (topOrigin.X, topOrigin.Y - arrowBigRadius + currentArrowSize);
                arrowPath.AddArc (topOrigin.X, topOrigin.Y, arrowSmallRadius, 3 * (float) Math.PI / 2.0f, 0, true);

                arrowPath.CloseSubpath();
                _arrowLayer.Path = arrowPath;
                _arrowLayer.FillRule = CAShapeLayer.FillRuleEvenOdd;
                arrowPath.Dispose();

                // add the highlight shape
                CGPath highlightPath = new CGPath();
                highlightPath.AddArc(topOrigin.X, topOrigin.Y, currentTopRadius, 0, (float)Math.PI, true);
                highlightPath.AddArc(topOrigin.X, topOrigin.Y + 1.25f, currentTopRadius, (float)Math.PI, 0, false);

                _highlightLayer.Path = highlightPath;
                _highlightLayer.FillRule = CAShapeLayer.FillRuleNonZero;
                highlightPath.Dispose();
            }
            else
            {
                // start the shape disappearance animation
                float radius = lerp(kMinBottomRadius, kMaxBottomRadius, 0.2f);
                CABasicAnimation pathMorph = CABasicAnimation.FromKeyPath("path");
                pathMorph.Duration = 0.15f;
                pathMorph.FillMode = CAFillMode.Forwards;
                pathMorph.RemovedOnCompletion = false;

                CGPath toPath = new CGPath();
                toPath.AddArc(topOrigin.X, topOrigin.Y, radius, 0, (float)Math.PI, true);
                toPath.AddCurveToPoint(topOrigin.X - radius, topOrigin.Y, topOrigin.X - radius, topOrigin.Y, topOrigin.X - radius, topOrigin.Y);
                toPath.AddArc(topOrigin.X, topOrigin.Y, radius, (float)Math.PI, 0, true);
                toPath.AddCurveToPoint(topOrigin.X + radius, topOrigin.Y, topOrigin.X + radius, topOrigin.Y, topOrigin.X + radius, topOrigin.Y);
                toPath.CloseSubpath();

                pathMorph.To = new NSValue(toPath.Handle);
                _shapeLayer.AddAnimation(pathMorph, null);

                CABasicAnimation shadowPathMorph = CABasicAnimation.FromKeyPath("shadowPath");
                shadowPathMorph.Duration = 0.15f;
                shadowPathMorph.FillMode = CAFillMode.Forwards;
                shadowPathMorph.RemovedOnCompletion = false;
                shadowPathMorph.To = new NSValue(toPath.Handle);

                _shapeLayer.AddAnimation(shadowPathMorph, null);
                toPath.Dispose();

                CABasicAnimation shapeAlphaAnimation = CABasicAnimation.FromKeyPath("opacity");
                shapeAlphaAnimation.Duration = 0.1f;
                shapeAlphaAnimation.BeginTime = CAAnimation.CurrentMediaTime() + 0.1f;
                shapeAlphaAnimation.To = new NSNumber(0);
                shapeAlphaAnimation.FillMode = CAFillMode.Forwards;
                shapeAlphaAnimation.RemovedOnCompletion = false;
                _shapeLayer.AddAnimation(shapeAlphaAnimation, null);

                CABasicAnimation alphaAnimation = CABasicAnimation.FromKeyPath("opacity");
                alphaAnimation.Duration = 0.1f;
                alphaAnimation.To = new NSNumber (0);
                alphaAnimation.FillMode = CAFillMode.Forwards;
                alphaAnimation.RemovedOnCompletion = false;

                _arrowLayer.AddAnimation(alphaAnimation, null);
                _highlightLayer.AddAnimation(alphaAnimation, null);

                CATransaction.Begin();
                CATransaction.DisableActions = true;
                activity.Layer.Transform = CATransform3D.MakeScale(0.1f, 0.1f, 1f);
                CATransaction.Commit();

                UIView.Animate (0.2f, 0.15f, UIViewAnimationOptions.CurveLinear, () => {
                    activity.Alpha = 1;
                    activity.Layer.Transform = CATransform3D.MakeScale(1, 1, 1);
                }, null);

                _refreshing = true;
                _canRefresh = false;
                this.SendActionForControlEvents(UIControlEvent.ValueChanged);

                if (this.Action != null)
                    this.Action();
            }
            path.Dispose();
        }