Beispiel #1
0
        void ExecuteWindowsSearchQuery()
        {
            string tempString     = queryText;
            int    index          = tempString.IndexOf('#');
            string queryWithParam = tempString.Remove(index, 1);

            if (query.Contains(""))
            {
                tempString = queryWithParam.Insert(index, "\"" + query + "\"");
            }
            else
            {
                tempString = queryWithParam.Insert(index, query);
            }

            SearchXPSItemCollection list = new SearchXPSItemCollection();

            try
            {
                using (OleDbConnection connection = new OleDbConnection(connectionString))
                {
                    connection.Open();

                    OleDbCommand    cmd    = new OleDbCommand(tempString, connection);
                    OleDbDataReader reader = cmd.ExecuteReader();
                    if (reader.HasRows)
                    {
                        int numColumns = reader.FieldCount;

                        object[] values = new object[numColumns];

                        while (reader.Read())
                        {
                            reader.GetValues(values);
                            string[] rowTextValues = GetRowTextValues(values);

                            SearchXPSItem searchXPSItem = new SearchXPSItem();
                            searchXPSItem.Name = rowTextValues[0];
                            searchXPSItem.Path = rowTextValues[1];
                            list.Add(searchXPSItem);
                        }
                    }
                }
            }
            catch { }

            if (uiDispatcher != null)
            {
                uiDispatcher.BeginInvoke(DispatcherPriority.Normal, new DispatcherOperationCallback(OnWindowsSearchCompleteEvent), (object)list);
            }
        }
Beispiel #2
0
        void PatientLocalSearchList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if ((e == null) || (e.AddedItems.Count == 0))
            {
                return;
            }

            SearchXPSItem xpsItem = e.AddedItems[0] as SearchXPSItem;

            if (xpsItem == null)
            {
                return;
            }

            if (xpsItem.Path == null)
            {
                return;
            }

            System.Diagnostics.Process.Start(xpsItem.Path);
        }