コード例 #1
0
        public override void SpeechRecognized(SpeechRecognizedEventArgs e)
        {
            string command = e.Result.Semantics.Value.ToString();


            DirectoryViewModel vm = this.DataContext as DirectoryViewModel;

            if (vm != null)
            {
                SubDirectoryViewModel allMatches = vm.SubDirectories.FirstOrDefault(sub => sub.Letter == "All Matches");

                if (allMatches != null)
                {
                    allMatches.Entries.Clear();
                    foreach (RecognizedPhrase match in e.Result.Alternates)
                    {
                        System.Diagnostics.Debug.WriteLine(match.Confidence + " " + match.Text);
                        string matchText = match.Semantics.Value != null?match.Semantics.Value.ToString() : match.Text;

                        SubDirectoryViewModel matchModel = vm.SubDirectories.FirstOrDefault(sd => sd.Entries.Any(entry => entry.FullName == matchText));
                        if (matchModel != null)
                        {
                            DirectoryEntryModel matchEntry = matchModel.Entries.First(entry => entry.FullName == matchText);

                            if (matchEntry != null)
                            {
                                allMatches.Entries.Add(matchEntry);
                            }
                        }
                    }

                    this.AlphaList.SelectedValue = allMatches;
                }
            }
        }
コード例 #2
0
        public DirectoryModel()
        {
            //Company subdomain
            BambooAPIClient bambooClient = new BambooAPIClient("Infragistics");
            //Api Key, shush it is secret
            bambooClient.setSecretKey("SECRET");

            //Setup the fields to be requested
            string[] fields = { "firstName", "lastName", "jobTitle", "WorkEmail", "department", "division", "location", "supervisor", "nickname", "mobilePhone", "workPhone", "workPhoneExtension", "sms\text","id" };

            //Create the directroy so it is ready to fill
            Directory = new List<DirectoryEntryModel>();

            BambooHTTPResponse resp;
            //Get string of employees
            resp = bambooClient.getEmployeesReport("csv", "Report", fields);
            string list = resp.getContentString();

            //Remove escape characters/sequance from the string
            list = list.Replace("\"", "");
            //Split the string by employees
            char[] splitEmployees = { '\n' };
            string[] employees = list.Split(splitEmployees);
            for (int i = 1; i < employees.Length - 1; i++)
            {

                //Split out the fields by comma "," as long as it is not follow by a space
                string[] splitDetails = { ",(?!\\s)" };
                string[] employee = Regex.Split(employees[i], ",(?!\\s)");
                DirectoryEntryModel entry = new DirectoryEntryModel();
                entry.FirstName = employee[0];
                entry.LastName = employee[1];
                entry.Title = employee[2];
                entry.WorkEmail = employee[3];
                entry.Department = employee[4];
                entry.Division = employee[5];
                entry.Location = employee[6];
                entry.ReportingTo = employee[7];
                entry.Nickname = employee[8];
                entry.CellPhone = employee[9];
                entry.WorkPhone = employee[10];
                entry.WorkExt = employee[11];
                entry.SMS = false;
                entry.ID = int.Parse(employee[12]);

                entry.Photo = GetImage(bambooClient.baseUrl, entry);

                //Add the entry to the directory
                Directory.Add(entry);
            }

            Directory.Sort(new DirectoryEntryModelComparer());
        }
コード例 #3
0
        internal void InitializeUI(string id)
        {
            this.timedOut = false;
            this.userId   = id;
            //look up the contact information and change label

            this.Dispatcher.Invoke((Action)(() =>
            {
                this.VideoPane.Visibility = System.Windows.Visibility.Collapsed;
                this.ConfirmationContainer.Visibility = System.Windows.Visibility.Visible;
                DirectoryEntryModel employee = directory.GetEntryByEmail(this.userId);
                this.ConfirmationTextBlock.Text = string.Format("Would you like to initiate a video call with {0}?", employee.FullName);
            }));
        }
コード例 #4
0
        private void EntryList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count > 0)
            {
                DirectoryEntryModel selectedEntry = e.AddedItems[0] as DirectoryEntryModel;

                if (selectedEntry != null)
                {
                    Grid mainWindowGrid = Window.GetWindow(this).FindName("MainWindowGrid") as Grid;
                    if (mainWindowGrid != null)
                    {
                        Utilities.MakeVideoCall(selectedEntry.WorkEmail, mainWindowGrid.Children, 15);
                    }
                }
            }
        }
コード例 #5
0
        private FileSystemModel BuildDirectoryModel(DirectoryInfo directory)
        {
            var infos = directory.GetFileSystemInfos();
            var items = new FileSystemEntryModel[infos.Length];

            for (int i = 0; i < infos.Length; i++)
            {
                var info = infos[i];

                if (info is DirectoryInfo)
                {
                    items[i] = new DirectoryEntryModel(info.Name);
                }
                else if (info is FileInfo fileInfo)
                {
                    items[i] = new FileEntryModel(info.Name, fileInfo.Length);
                }
            }

            return(new FileSystemModel(items, isArchive: false));
        }
コード例 #6
0
        public BitmapImage GetImage(string baseURL, DirectoryEntryModel entry)
        {
            BitmapImage retVal = new BitmapImage();
            string hashedEmail = GetMd5Hash(entry.WorkEmail);

            //// throws an exception about not having permissions from the server
            //string fullURL = string.Format("{0}/v1/employees/{1}/photo/small", baseURL, entry.ID);

            string fullURL = string.Format("https://infragistics.bamboohr.com/employees/photos/?h={0}", hashedEmail);

            WebClient web = new WebClient();

            byte[] imageData = web.DownloadData(fullURL);
            MemoryStream stream = new MemoryStream(imageData);
            retVal.BeginInit();
            retVal.StreamSource = stream;
            retVal.CacheOption = BitmapCacheOption.OnLoad;
            retVal.EndInit();

            stream.Close();

            return retVal;
        }