コード例 #1
0
        private void ListenInner(string command, ExtensionCallback callback)
        {
            if (ExtensionMap.ContainsKey(command))
            {
                Debug.Log("Already listening command: " + command);
                return;
            }

            ExtensionMap.Add(command, callback);
        }
コード例 #2
0
        public MemoryDirectoryService(IEnumerable <Person> people)
        {
            this.people     = people.ToList();
            this.properties = typeof(Person).GetRuntimeProperties().ToDictionary(p => p.Name);


            Task.Factory.StartNew(async() =>
            {
                try
                {
                    var lookup = new Dictionary <long, string>();

                    foreach (var person in people)
                    {
                        if (!string.IsNullOrEmpty(person.Hauptnummer1))
                        {
                            AddEntry(lookup, GetPhoneNumber(person.Hauptnummer1), person.SafeDisplayName);
                        }
                        if (!string.IsNullOrEmpty(person.Hauptnummer2))
                        {
                            AddEntry(lookup, GetPhoneNumber(person.Hauptnummer2), person.SafeDisplayName + " (Hauptnummer 2)");
                        }
                        if (!string.IsNullOrEmpty(person.TelefonSekretariat))
                        {
                            AddEntry(lookup, GetPhoneNumber(person.TelefonSekretariat), $"{person.SafeDisplayName} (Sekretariat) {person.Personalbereich} {person.Organisation}");
                        }
                        if (!string.IsNullOrEmpty(person.Telefon))
                        {
                            AddEntry(lookup, GetPhoneNumber(person.Telefon), $"{person.SafeDisplayName} {person.Personalbereich} {person.Organisation}");
                        }
                        if (!string.IsNullOrEmpty(person.Telefon2))
                        {
                            AddEntry(lookup, GetPhoneNumber(person.Telefon2), $"{person.SafeDisplayName} {person.Personalbereich} {person.Organisation} (Telefon 2)");
                        }
                        if (!string.IsNullOrEmpty(person.Mobil))
                        {
                            AddEntry(lookup, GetPhoneNumber(person.Mobil), $"{person.SafeDisplayName} {person.Personalbereich} {person.Organisation} (Mobil)");
                        }
                        if (!string.IsNullOrEmpty(person.SMS))
                        {
                            AddEntry(lookup, GetPhoneNumber(person.SMS), $"{person.SafeDisplayName} {person.Personalbereich} {person.Organisation} (Mobil Direkt)");
                        }
                    }

                    var sorted = lookup.OrderBy(i => i.Key);

                    var result = await DependencyService.Get <ICallDirectoryStore>()?.Store(sorted);
                    ExtensionCallback?.Invoke(result);
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception);
                }
            });
        }
コード例 #3
0
 public void Listen(string command, ExtensionCallback callback)
 {
     //            ListenInner(command, callback);
 }
コード例 #4
0
        /*
         * public T GetEntity<T>(string command) where T : new()
         * {
         *  var commands = command.Split('_');
         *
         *  if (commands.Length > 1)
         *      command = commands[1];
         *
         *  if (DataMap.ContainsKey(command))
         *  {
         *      var genericResponseVo = JsonConvert.DeserializeObject<GenericResponseVo>(DataMap[command].ToString());
         *      var deserializeObject = JsonConvert.DeserializeObject<T>(genericResponseVo.entity);
         *      return deserializeObject;
         *  }
         *
         *  return new T();
         * }*/

        public void Listen(string command, ExtensionCallback callback)
        {
            command = command.Split('_')[1];

            ListenInner(command, callback);
        }
コード例 #5
0
 public static void RVExtensionRegisterCallback([MarshalAs(UnmanagedType.FunctionPtr)] ExtensionCallback func)
 {
     callback = func;
 }