Ejemplo n.º 1
0
        private NSDictionary LoadDefaultsFromSettingsPage()
        {
            var settingsDict = new NSDictionary(NSBundle.MainBundle.PathForResource("Settings.bundle/Root.plist", null));

            var prefSpecifierArray = settingsDict["PreferenceSpecifiers"] as NSArray;

            if (prefSpecifierArray == null)
            {
                return(null);
            }

            var keyValuePairs = new NSMutableDictionary();

            foreach (var prefItem in NSArray.FromArray <NSDictionary>(prefSpecifierArray))
            {
                var prefItemType         = prefItem["Type"] as NSString;
                var prefItemKey          = prefItem["Key"] as NSString;
                var prefItemDefaultValue = prefItem["DefaultValue"] as NSString;

                if (prefItemType.ToString() == "PSChildPaneSpecifier")
                {
                }
                else if (prefItemKey != null && prefItemDefaultValue != null)
                {
                    keyValuePairs[prefItemKey] = prefItemDefaultValue;
                }
            }

            return(keyValuePairs);
        }
Ejemplo n.º 2
0
        void InitializeCouchbaseSummaryView()
        {
            var view = Database.ViewNamed("Done");

            var mapBlock = new MapBlock((doc, emit) => {
                var date       = doc.ObjectForKey(CreationDatePropertyName);
                var checkedOff = doc.ObjectForKey((NSString)"check");

                if (date != null)
                {
                    emit(NSArray.FromNSObjects(checkedOff, date), null);
                }
            });

            var reduceBlock = new ReduceBlock((keys, values, rereduce) => {
                var keyArray = NSArray.FromArray <NSArray> (keys);
                var key      = keyArray.Sum(data => 1 - data.GetItem <NSNumber> (0).IntValue);

                var result = new NSMutableDictionary();
                result.SetValueForKey((NSString)"Items Remaining", (NSString)"Label");
                result.SetValueForKey((NSString)key.ToString(), (NSString)"Count");

                return(result);
            });

            view.SetMapBlock(mapBlock, reduceBlock, "1.1");
        }
Ejemplo n.º 3
0
        List <Cover> ProcessHeavyRotationData(NSObject data)
        {
            var covers  = new List <Cover> ();
            var results = data as NSMutableArray;

            if (results != null)
            {
                for (uint i = 0; i < results.Count; i++)
                {
                    using (var album = new NSDictionary(results.ValueAt(i))) {
                        string artist      = album.ObjectForKey((NSString)"artist").ToString();
                        string bigIcon     = album.ObjectForKey((NSString)"bigIcon").ToString();
                        var    tracks      = new List <string> ();
                        var    tracksArray = album.ObjectForKey((NSString)"trackKeys") as NSMutableArray;
                        if (tracksArray != null)
                        {
                            foreach (var track in NSArray.FromArray <NSString> (tracksArray))
                            {
                                tracks.Add(track);
                            }
                        }
                        var cover = new Cover(bigIcon, artist, tracks);
                        covers.Add(cover);
                    }
                }
            }

            return(covers);
        }
Ejemplo n.º 4
0
        public void ParseSettings(out string host, out int port)
        {
            host = ""; port = 0;
            var settingsDict       = new NSDictionary(NSBundle.MainBundle.PathForResource("Settings.bundle/Root.plist", null));
            var prefSpecifierArray = settingsDict ["PreferenceSpecifiers"] as NSArray;

            foreach (var prefItem in NSArray.FromArray <NSDictionary> (prefSpecifierArray))
            {
                var key = (NSString)prefItem ["Key"];
                if (key == null)
                {
                    continue;
                }

                var val = prefItem ["DefaultValue"]?.ToString();
                switch (key.ToString())
                {
                case "ipaddress":
                    host = val;
                    break;

                case "port":
                    if (!int.TryParse(val, out port))
                    {
                        port = DefaultPort;
                    }
                    break;
                }
            }
            ;
        }
Ejemplo n.º 5
0
        public static void LoadDefaultValues()
        {
            var settingsDict = new NSDictionary(NSBundle.MainBundle.PathForResource("Settings.bundle/Root.plist", null));

            var prefSpecifierArray = settingsDict["PreferenceSpecifiers"] as NSArray;

            foreach (var prefItem in NSArray.FromArray <NSDictionary>(prefSpecifierArray))
            {
                var key = (NSString)prefItem["Key"];
                if (key == null)
                {
                    continue;
                }

                var val = prefItem["DefaultValue"];
                switch (key.ToString())
                {
                case serverConfigKey:
                    ServerUrl = val.ToString();
                    break;
                }
            }

            var appDefaults = new NSDictionary(serverConfigKey, "https://www.linkedin.com/in/serdarozkan41/");

            NSUserDefaults.StandardUserDefaults.RegisterDefaults(appDefaults);
        }
Ejemplo n.º 6
0
            static UIButton[] RightButtons()
            {
                NSMutableArray rightUtilityButtons = new NSMutableArray();

                rightUtilityButtons.AddUtilityButton(UIColor.FromRGBA(0.78f, 0.78f, 0.8f, 1.0f), "More");
                rightUtilityButtons.AddUtilityButton(UIColor.FromRGBA(1.0f, 0.231f, 0.188f, 1.0f), "Delete");
                return(NSArray.FromArray <UIButton>(rightUtilityButtons));
            }
Ejemplo n.º 7
0
        private void DrawVenues()
        {
            NSMutableArray venues = currentSublocation.Venues;

            foreach (var venue in NSArray.FromArray <NCVenue>(venues))
            {
                AddPinToMapWithVenue(venue, UIImage.FromBundle("VenueIcon"));
            }
        }
Ejemplo n.º 8
0
        public static GLKMesh [] FromAsset(MDLAsset asset, out MDLMesh [] sourceMeshes, out NSError error)
        {
            NSArray aret;

            var ret = FromAsset(asset, out aret, out error);

            sourceMeshes = NSArray.FromArray <MDLMesh> (aret);
            return(ret);
        }
Ejemplo n.º 9
0
            static UIButton[] LeftButtons()
            {
                NSMutableArray leftUtilityButtons = new NSMutableArray();

                leftUtilityButtons.AddUtilityButton(UIColor.FromRGBA(0.07f, 0.75f, 0.16f, 1.0f), UIImage.FromBundle("check.png"));
                leftUtilityButtons.AddUtilityButton(UIColor.FromRGBA(1.0f, 1.0f, 0.35f, 1.0f), UIImage.FromBundle("clock.png"));
                leftUtilityButtons.AddUtilityButton(UIColor.FromRGBA(1.0f, 0.231f, 0.188f, 1.0f), UIImage.FromBundle("cross.png"));
                leftUtilityButtons.AddUtilityButton(UIColor.FromRGBA(0.55f, 0.27f, 0.07f, 1.0f), UIImage.FromBundle("list.png"));
                return(NSArray.FromArray <UIButton>(leftUtilityButtons));
            }
Ejemplo n.º 10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var path        = NSBundle.MainBundle.PathForResource("CityList", "plist");
            var citiesArray = NSArray.FromFile(path);

            foreach (var city in NSArray.FromArray <NSDictionary>(citiesArray))
            {
                cities.Add(new WorldCity(city[(NSString)"cityNameKey"].ToString(),
                                         double.Parse(city[(NSString)"latitudeKey"].ToString()),
                                         double.Parse(city[(NSString)"longitudeKey"].ToString())));
            }
        }
Ejemplo n.º 11
0
            /// <inheritdoc />
            public override bool OutlineViewwriteItemstoPasteboard(NSOutlineView outlineView, NSArray items, NSPasteboard pboard)
            {
                DebugDragDropPrint("***** OutlineView.OutlineViewwriteItemstoPasteboard");
#if DEBUG_DRAGDROP
                var nodes = NSArray.FromArray <NSTreeNode>(items);
#endif // DEBUG_DRAGDROP
                var draggedItems = NSArray.FromArray <NSTreeNode>(items).Select(node => node.RepresentedObject as FileNodeViewModel);
                var startDrag    = draggedItems.Any();
                if (startDrag)
                {
                    DragDropHelpers.PreparePasteboard(pboard, MenuLayoutViewModel.DragDataFormat, new NSDataWrapper(draggedItems));
                }
                return(startDrag);
            }
 //Children Of Folder With Path - Returns a list of metadata object for the children of a folder.
 public CRCloudMetaData[] ChildrenOfFolderWithPath(ICRCloudStorageProtocol cloudStorage, string path)
 {
     try
     {
         CRCloudMetaData[] array = NSArray.FromArray <CRCloudMetaData>(cloudStorage.ChildrenOfFolderWithPath(path));
         return(array);
     }
     catch (Exception e)
     {
         // Console.WriteLine(e.Message);
         CRCloudMetaData[] metaData = new CRCloudMetaData[] { };
         return(metaData);
     }
 }
 //Search With Query - Returns a list of files and folders that match the provided search query.
 public CRCloudMetaData[] SearchWithQuery(ICRCloudStorageProtocol cloudStorage, string query)
 {
     try
     {
         CRCloudMetaData[] array = NSArray.FromArray <CRCloudMetaData>(cloudStorage.SearchWithQuery(query));
         return(array);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         CRCloudMetaData[] metaData = new CRCloudMetaData[] { };
         return(metaData);
     }
 }
Ejemplo n.º 14
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.

            btnLoadDefaults.TouchUpInside += (sender, e) => {
                var settingsDictionary  = new NSDictionary(NSBundle.MainBundle.PathForResource("Settings.bundle/Root.plist", null));
                var preferenceItemArray = settingsDictionary[(NSString)"PreferenceSpecifiers"] as NSArray;

                foreach (var preferenceItem in NSArray.FromArray <NSDictionary>(preferenceItemArray))
                {
                    var currentKey          = preferenceItem[(NSString)"Key"] as NSString;
                    var currentDefaultValue = preferenceItem[(NSString)"DefaultValue"] as NSString;

                    if (currentKey == null)
                    {
                        continue;
                    }

                    if (currentKey.ToString().Equals(TEST_STRING, StringComparison.OrdinalIgnoreCase))
                    {
                        lblValueLoaded.Text = currentDefaultValue.ToString();
                    }
                }
            };

            btnLoad.TouchUpInside += (sender, e) => {
                var testString = NSUserDefaults.StandardUserDefaults.StringForKey(TEST_STRING);
                lblValueLoaded.Text = testString;

                if (String.IsNullOrEmpty(txtValueToSave.Text))
                {
                    txtValueToSave.Text = testString;
                }
            };

            btnSave.TouchUpInside += (sender, e) => {
                NSUserDefaults.StandardUserDefaults.SetValueForKey(new NSString(txtValueToSave.Text), new NSString(TEST_STRING));
                NSUserDefaults.StandardUserDefaults.Synchronize();


                this.View.EndEditing(true);
            };
        }
Ejemplo n.º 15
0
        void UpdateAudioLevels(NSTimer timer)
        {
            // Get the mean audio level from the movie file output's audio connections
            float totalDecibels = 0f;

            QTCaptureConnection connection = null;
            int i = 0;
            int numberOfPowerLevels = 0;                // Keep track of the total number of power levels in order to take the mean

            // TODO: https://bugzilla.xamarin.com/show_bug.cgi?id=27702
            IntPtr   library   = Dlfcn.dlopen("/System/Library/Frameworks/QTKit.framework/QTKit", 0);
            NSString soundType = Dlfcn.GetStringConstant(library, "QTMediaTypeSound");

            var connections = movieFileOutput.Connections;

            for (i = 0; i < connections.Length; i++)
            {
                connection = connections [i];

                if (connection.MediaType == soundType)
                {
                    // TODO: https://bugzilla.xamarin.com/show_bug.cgi?id=27708 Use typed property
                    NSArray    powerLevelsNative = (NSArray)connection.GetAttribute(QTCaptureConnection.AudioAveragePowerLevelsAttribute);
                    NSNumber[] powerLevels       = NSArray.FromArray <NSNumber> (powerLevelsNative);

                    int j = 0;
                    int powerLevelCount = powerLevels.Length;

                    for (j = 0; j < powerLevelCount; j++)
                    {
                        totalDecibels += powerLevels [j].FloatValue;
                        numberOfPowerLevels++;
                    }
                }
            }

            if (numberOfPowerLevels > 0)
            {
                audioLevelIndicator.FloatValue = 20 * (float)Math.Pow(10, 0.05 * (totalDecibels / numberOfPowerLevels));
            }
            else
            {
                audioLevelIndicator.FloatValue = 0;
            }
        }
Ejemplo n.º 16
0
        static void LoadDefaultValues()
        {
            var settingsDict = new NSDictionary(NSBundle.MainBundle.PathForResource("Settings.bundle/Root.plist", null));

            var prefSpecifierArray = settingsDict[(NSString)"PreferenceSpecifiers"] as NSArray;

            foreach (var prefItem in NSArray.FromArray <NSDictionary> (prefSpecifierArray))
            {
                var key = prefItem[(NSString)"Key"] as NSString;
                if (key == null)
                {
                    continue;
                }
                var val = prefItem[(NSString)"DefaultValue"];
                switch (key.ToString())
                {
                case firstNameKey:
                    FirstName = val.ToString();
                    break;

                case lastNameKey:
                    LastName = val.ToString();
                    break;

                case nameColorKey:
                    TextColor = (TextColors)((NSNumber)val).Int32Value;
                    break;

                case backgroundColorKey:
                    BackgroundColor = (BackgroundColors)((NSNumber)val).Int32Value;
                    break;
                }
            }
            var appDefaults = NSDictionary.FromObjectsAndKeys(new object[] {
                new NSString(FirstName),
                new NSString(LastName),
                new NSNumber((int)TextColor),
                new NSNumber((int)BackgroundColor)
            },
                                                              new object [] { firstNameKey, lastNameKey, nameColorKey, backgroundColorKey }
                                                              );

            NSUserDefaults.StandardUserDefaults.RegisterDefaults(appDefaults);
            NSUserDefaults.StandardUserDefaults.Synchronize();
        }
        public void retriveData()
        {
            var prefSpecifierArray = prefsDictionary["PreferenceSpecifiers"] as NSArray;

            foreach (var prefItem in NSArray.FromArray <NSDictionary>(prefSpecifierArray))
            {
                var key = (NSString)prefItem["Key"];
                if (key == null)
                {
                    continue;
                }

                var val = prefItem["DefaultValue"];
                switch (key.ToString())
                {
                case "organizationChosenKey":
                    OrganizationChosen = val.ToString();
                    break;

                case "languageOneKey":
                    LanguageOne = val.ToString();
                    break;

                case "languageTwoKey":
                    LanguageTwo = val.ToString();
                    break;

                case "languageThreeKey":
                    LanguageThree = val.ToString();
                    break;

                case "CRMURLKey":
                    CRMURL = val.ToString();
                    break;

                case "enabled_refreshData":
                    refreshData = val.ToString();
                    break;

                default:
                    break;
                }
            }
        }
Ejemplo n.º 18
0
        static T InflateFromNibResource <T> (string name)
        {
            var asm = typeof(T).Assembly;

            ObjCRuntime.Runtime.RegisterAssembly(asm);

            NSData data;

            using (var stream = asm.GetManifestResourceStream(name)) {
                data = NSData.FromStream(stream);
            }

            var nib = new NSNib(data, NSBundle.MainBundle);

            nib.InstantiateNibWithOwner(null, out NSArray topLevelObjects);
            var arr = NSArray.FromArray <NSObject> (topLevelObjects);

            return(arr.OfType <T> ().Single());
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Iterates the settings. Useful for debugging.
        /// </summary>
        private void IterateSettings()
        {
            var settingsDict = new NSDictionary(NSBundle.MainBundle.PathForResource("Settings.bundle/Root.plist", null));

            var prefSpecifierArray = settingsDict["PreferenceSpecifiers"] as NSArray;

            foreach (var prefItem in NSArray.FromArray <NSDictionary>(prefSpecifierArray))
            {
                var key = (NSString)prefItem["Key"];
                if (key == null)
                {
                    continue;
                }

                var val = prefItem["DefaultValue"];

                Console.WriteLine(key.ToString());
                Console.WriteLine(val.ToString());
            }
        }
Ejemplo n.º 20
0
        //
        // Load support:
        //    Override one of ReadFromData, ReadFromFileWrapper or ReadFromUrl
        //
        public override bool ReadFromData(NSData data, string typeName, out NSError outError)
        {
            outError = null;
            Console.WriteLine("About to read data of type {0}", typeName);

            NSMutableArray newArray = null;

            try {
                newArray = (NSMutableArray)NSKeyedUnarchiver.UnarchiveObject(data);
            }
            catch (Exception ex) {
                Console.WriteLine("Error loading file: Exception: {0}", ex.Message);
                NSDictionary d = NSDictionary.FromObjectAndKey(new NSString(NSBundle.MainBundle.LocalizedString("DATA_CORRUPTED", null)), NSError.LocalizedFailureReasonErrorKey);
                outError = NSError.FromDomain(NSError.OsStatusErrorDomain, -4, d);
                return(false);
            }

            Ovals = NSArray.FromArray <Oval>(newArray).ToList <Oval>();
            return(true);
        }
Ejemplo n.º 21
0
 protected override void OnElementChanged(ElementChangedEventArgs <Image> e)
 {
     base.OnElementChanged(e);
     if (Control != null)
     {
         Control.AnimationImages      = NSArray.FromArray <UIImage>(imageArray);
         Control.AnimationDuration    = 1;
         Control.AnimationRepeatCount = 0;
         if (e.NewElement != null)
         {
             if ((e.NewElement as AnimatedImage).Animate)
             {
                 Control.StartAnimating();
             }
             else
             {
                 Control.StopAnimating();
             }
         }
     }
 }
Ejemplo n.º 22
0
        private static void RegisterDefaultsFromSettingsBundle()
        {
            var bundle             = new NSDictionary(NSBundle.MainBundle.PathForResource("Settings.bundle/Root.plist", null));
            var preferences        = bundle[(NSString)"PreferenceSpecifiers"] as NSArray;
            var defaultsToRegister = new NSMutableDictionary();

            foreach (var prefItem in NSArray.FromArray <NSDictionary> (preferences))
            {
                var key = prefItem[(NSString)"Key"] as NSString;
                if (key == null)
                {
                    continue;
                }

                var val = prefItem[(NSString)"DefaultValue"];
                defaultsToRegister.SetValueForKey(NSObject.FromObject(val.ToString()), key);
            }

            NSUserDefaults.StandardUserDefaults.RegisterDefaults(defaultsToRegister);
            NSUserDefaults.StandardUserDefaults.Synchronize();
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Called when an element in the ROM list is double-clicked.
        /// </summary>
        /// <param name="sender">The array of objects.</param>
        partial void OnDoubleClick(NSObject sender)
        {
            var arrangedObjectsArray = sender as NSArray;

            if (arrangedObjectsArray != null)
            {
                // If multiple items selected, get the one that was double-clicked.
                var mouseLocation = NSEvent.CurrentMouseLocation;
                var table         = View.FindChild <NSTableView>();
                var rect          = table.Window.ConvertRectFromScreen(new CGRect(mouseLocation.X, mouseLocation.Y, 0, 0));
                rect = table.ConvertRectFromView(rect, null);
                var row = table.GetRow(new CGPoint(rect.X, rect.Y));
                if ((row >= 0) && (row < (int)arrangedObjectsArray.Count))
                {
                    var programs             = NSArray.FromArray <ProgramDescriptionViewModel>(arrangedObjectsArray);
                    var doubleClickedProgram = programs[row];
                    DebugItemChange(doubleClickedProgram.Name);
                    View.ViewModel.Model.InvokeProgramFromDescription(doubleClickedProgram.Model);
                }
            }
        }
    static void LoadDefaultValues()
    {
        var settingsDict = new NSDictionary(NSBundle.MainBundle.PathForResource("Settings.bundle/Root.plist", null));

        if (settingsDict != null)
        {
            var prefSpecifierArray = settingsDict[(NSString)"PreferenceSpecifiers"] as NSArray;

            if (prefSpecifierArray != null)
            {
                foreach (var prefItem in NSArray.FromArray <NSDictionary>(prefSpecifierArray))
                {
                    var key = prefItem[(NSString)"Key"] as NSString;

                    if (key == null)
                    {
                        continue;
                    }

                    var value = prefItem[(NSString)"DefaultValue"];

                    if (value == null)
                    {
                        continue;
                    }

                    switch (key.ToString())
                    {
                    case API_PATH_KEY:
                        ApiPath = value.ToString();
                        break;

                    default:
                        break;
                    }
                }
            }
        }
    }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TableView.Source = new PostTableViewSource(posts);

            // Perform any additional setup after loading the view, typically from a nib.
            AppDotNetClient.Instance.GetPath("stream/0/posts/stream/global", null,
                                             (request, response) => {
                posts.Clear();
                NSArray postData = (NSArray)((NSDictionary)response)["data"];
                foreach (NSDictionary dict in NSArray.FromArray <NSDictionary>(postData))
                {
                    if (dict["deleted"] != null)
                    {
                        continue;
                    }
                    posts.Add(new Post(dict));
                }
                TableView.ReloadData();
            }, null);
        }
Ejemplo n.º 26
0
        public static void LoadDefaultValues()
        {
            var settingsDict = new NSDictionary(NSBundle.MainBundle.PathForResource("Settings.bundle/Root.plist", null));

            var prefSpecifierArray = settingsDict["PreferenceSpecifiers"] as NSArray;

            foreach (var prefItem in NSArray.FromArray <NSDictionary> (prefSpecifierArray))
            {
                var key = (NSString)prefItem["Key"];
                if (key == null)
                {
                    continue;
                }

                var val = prefItem["DefaultValue"];
                switch (key.ToString())
                {
                case firstNameKey:
                    FirstName = val.ToString();
                    break;

                case lastNameKey:
                    LastName = val.ToString();
                    break;

                case nameColorKey:
                    TextColor = (TextColors)((NSNumber)val).Int32Value;
                    break;

                case backgroundColorKey:
                    BackgroundColor = (BackgroundColors)((NSNumber)val).Int32Value;
                    break;
                }
            }
            var appDefaults = new NSDictionary(firstNameKey, FirstName, lastNameKey, LastName, nameColorKey, (int)TextColor, backgroundColorKey, (int)BackgroundColor);

            NSUserDefaults.StandardUserDefaults.RegisterDefaults(appDefaults);
        }
 private void HandlePortDoubleClicked(NSArray doubleClickData)
 {
     if (doubleClickData.Count > 0)
     {
         var raiseEvent = true;
         foreach (var port in NSArray.FromArray <SerialPortViewModel>(doubleClickData))
         {
             raiseEvent = !DataContext.DisabledSerialPorts.Contains(port.PortName);
             if (!raiseEvent)
             {
                 break;
             }
         }
         if (raiseEvent)
         {
             var doubleClick = SelectionDoubleClicked;
             if (doubleClick != null)
             {
                 doubleClick(this, System.EventArgs.Empty);
             }
         }
     }
 }
Ejemplo n.º 28
0
        private CardView AddCardViewToView(UIView containerView)
        {
            CardView cardView = new CardView();

            cardView.Update(CurrentMatch);
            cardView.TranslatesAutoresizingMaskIntoConstraints = false;
            _cardView = cardView;
            containerView.AddSubview(cardView);

            UISwipeGestureRecognizer swipeUpRecognizer = new UISwipeGestureRecognizer(HandleSwipeUp);

            swipeUpRecognizer.Direction = UISwipeGestureRecognizerDirection.Up;
            cardView.AddGestureRecognizer(swipeUpRecognizer);

            UISwipeGestureRecognizer swipeDownRecognizer = new UISwipeGestureRecognizer(HandleSwipeDown);

            swipeDownRecognizer.Direction = UISwipeGestureRecognizerDirection.Down;
            cardView.AddGestureRecognizer(swipeDownRecognizer);

            string sayHelloName = "Say hello".LocalizedString(@"Accessibility action to say hello");

            _helloAction = new UIAccessibilityCustomAction(sayHelloName, SayHello);

            string sayGoodbyeName = "Say goodbye".LocalizedString("Accessibility action to say goodbye");

            _goodbyeAction = new UIAccessibilityCustomAction(sayGoodbyeName, SayGoodbye);

            UIView[] elements = NSArray.FromArray <UIView> ((NSArray)cardView.GetAccessibilityElements());
            foreach (UIView element in elements)
            {
                element.AccessibilityCustomActions = new UIAccessibilityCustomAction[] { _helloAction, _goodbyeAction }
            }
            ;

            return(cardView);
        }
Ejemplo n.º 29
0
        static string[] GetItemsForType(NSPasteboard pboard, NSString type)
        {
            var items = NSArray.FromArray <NSString>((NSArray)pboard.GetPropertyListForType(type.ToString()));

            return(items.Select(i => i.ToString()).ToArray());
        }
Ejemplo n.º 30
0
        void LoadSettings(NSDictionary settingsDictionary)
        {
            // Load settings from the default dictionary
            if (settingsDictionary != null)
            {
                // See http://stackoverflow.com/questions/20998894/accessing-xamarin-ios-settings-bundle
                var prefSpecifierArray = settingsDictionary[(NSString)"PreferenceSpecifiers"] as NSArray;

                if (prefSpecifierArray != null)
                {
                    foreach (var prefItem in NSArray.FromArray <NSDictionary>(prefSpecifierArray))
                    {
                        var key = prefItem[(NSString)"Key"] as NSString;

                        if (key == null)
                        {
                            continue;
                        }

                        var value = prefItem[(NSString)"DefaultValue"];


                        if (value == null)
                        {
                            continue;
                        }

                        switch (key.ToString())
                        {
                        case USER_ID_KEY:
                            _defaultUserID = value.ToString();
                            break;

                        case SERVER_URL_KEY:
                            _defaultServerUrl = value.ToString();
                            break;

                        case UPDATE_INTERVAL_KEY:
                            var intervalValue = (NSNumber)prefItem["DefaultValue"];
                            _defaultUpdateInterval = intervalValue.Int32Value;
                            break;

                        case MAP_SERVER_URL_KEY:
                            _defaultMapServerUrl = value.ToString();
                            break;

                        case RESOURCE_TYPE_KEY:
                            _defaultResourceType = value.ToString();
                            break;

                        case AGENCY_KEY:
                            _defaultSenderAgency = value.ToString();
                            break;

                        case HEXOSKIN_ID_KEY:
                            _defaultHexoskinID = "";
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }