/// <summary>
        /// このページには、移動中に渡されるコンテンツを設定します。前のセッションからページを
        /// 再作成する場合は、保存状態も指定されます。
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: 問題のドメインでサンプル データを置き換えるのに適したデータ モデルを作成します
            var item = await SampleDataSource.GetItemAsync((String)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;
        }
Beispiel #2
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var group = await SampleDataSource.GetGroupAsync((String)e.NavigationParameter);

            this.DefaultViewModel["Group"] = group;
            this.DefaultViewModel["Items"] = group.Items;

            if (e.PageState == null)
            {
                this.itemListView.SelectedItem = null;
                // When this is a new page, select the first item automatically unless logical page
                // navigation is being used (see the logical page navigation #region below.)
                if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null)
                {
                    this.itemsViewSource.View.MoveCurrentToFirst();
                }
            }
            else
            {
                // Restore the previously saved state associated with this page
                if (e.PageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null)
                {
                    var selectedItem = await SampleDataSource.GetItemAsync((String)e.PageState["SelectedItem"]);

                    this.itemsViewSource.View.MoveCurrentTo(selectedItem);
                }
            }
        }
        /// <summary>
        /// Preenche a página com conteúdo transmitido durante a navegação. Qualquer estado salvo também é
        /// fornecido ao recriar uma página a partir de uma sessão anterior.
        /// </summary>
        /// <param name="sender">
        /// A origem do evento; geralmente <see cref="NavigationHelper"/>.
        /// </param>
        /// <param name="e">Dados de evento que fornecem o parâmetro de navegação passado para
        /// <see cref="Frame.Navigate(Type, Object)"/> quando esta página foi solicitada inicialmente e
        /// um dicionário de estado preservado por esta página durante uma sessão
        /// anterior.  O estado será nulo na primeira vez que uma página for visitada.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Crie um modelo de dados apropriado ao seu domínio de problema para substituir os dados de exemplo.
            var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;
        }
Beispiel #4
0
        /// <summary>
        /// 使用在导航过程中传递的内容填充页。在从以前的会话
        /// 重新创建页时,也会提供任何已保存状态。
        /// </summary>
        /// <param name="sender">
        /// 事件的来源;通常为 <see cref="NavigationHelper"/>。
        /// </param>
        /// <param name="e">事件数据,其中既提供在最初请求此页时传递给
        /// <see cref="Frame.Navigate(Type, Object)"/> 的导航参数,又提供
        /// 此页在以前会话期间保留的状态的
        /// 字典。首次访问页面时,该状态将为 null。</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: 创建适用于问题域的合适数据模型以替换示例数据。
            var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;
        }
Beispiel #5
0
        /// <summary>
        /// Заполняет страницу содержимым, передаваемым в процессе навигации. Также предоставляется (при наличии) сохраненное состояние
        /// при повторном создании страницы из предыдущего сеанса.
        /// </summary>
        /// <param name="sender">
        /// Источник события; как правило, <see cref="NavigationHelper"/>.
        /// </param>
        /// <param name="e">Данные события, предоставляющие параметр навигации, который передается в
        /// <see cref="Frame.Navigate(Type, Object)"/> при первоначальном запросе этой страницы, и
        /// словарь состояний, сохраненных этой страницей в ходе предыдущего
        /// сеанса.  Состояние будет равно значению NULL при первом посещении страницы.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Создайте соответствующую модель данных для своей проблемной области, чтобы заменить ими данные-пример.
            var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;
        }
Beispiel #6
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var sampleDataGroup = await SampleDataSource.GetItemAsync("Group-4");

            this.DefaultViewModel["Section3Items"] = sampleDataGroup;
        }
Beispiel #7
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var item = await SampleDataSource.GetItemAsync((String)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;
        }
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var itemId = e.NavigationParameter as string;

            if (itemId != null)
            {
                UserData.ItemId = itemId;
            }
            else
            {
                UserData = (HubContext)e.NavigationParameter;
            }

            var item = await SampleDataSource.GetItemAsync(UserData.ItemId);

            Model.Item = item;
            InputSelectionPanel2.Visibility = (item.RequiresInputComboBox2) ? Visibility.Visible : Visibility.Collapsed;
            InputTextBox.Visibility         = (item.RequiresInputTextBox) ? Visibility.Visible : Visibility.Collapsed;
            if (item.RequiresInputComboBox1)
            {
                var response = await SampleDataSource.ExecuteApiPrereq(item.UniqueId, UserData.Provider, UserData.UseBeta);

                if (response is List <ApiBaseResponse> )
                {
                    InputComboBox1.ItemsSource      = response;
                    InputSelectionPanel1.Visibility = Visibility.Visible;
                }
            }
            else
            {
                InputSelectionPanel1.Visibility = Visibility.Collapsed;
            }
        }
        private async void myME_MediaEnded(object sender, RoutedEventArgs e)
        {
            Button         btnSecureStop;
            SampleDataItem item;

            if (((MediaElement)sender).Name == "myME")
            {
                btnSecureStop = btnMeteringOrSecureStop1;
                item          = await SampleDataSource.GetItemAsync(itemIds[0]);
            }
            else if (((MediaElement)sender).Name == "myME2")
            {
                btnSecureStop = btnMeteringOrSecureStop2;
                item          = await SampleDataSource.GetItemAsync(itemIds[1]);
            }
            else
            {
                btnSecureStop = btnMeteringOrSecureStop3;
                item          = await SampleDataSource.GetItemAsync(itemIds[2]);
            }

            if (item.SecureStopCertFile != "null")
            {
                btnSecureStop.IsEnabled = true;
            }

            updateStatus("MediaEnded", sender);
            LogMessage("MediaEnded");
        }
        /// <summary>
        /// このページには、移動中に渡されるコンテンツを設定します。前のセッションからページを
        /// 再作成する場合は、保存状態も指定されます。
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var group = await SampleDataSource.GetGroupAsync((String)e.NavigationParameter);

            this.DefaultViewModel["Group"] = group;
            this.DefaultViewModel["Items"] = group.Items;

            if (e.PageState == null)
            {
                this.itemListView.SelectedItem = null;
                // 新しいページの場合、論理ページ ナビゲーションが使用されている場合を除き、自動的に
                // 最初のアイテムを選択します (以下の論理ページ ナビゲーションの #region を参照)。
                if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null)
                {
                    this.itemsViewSource.View.MoveCurrentToFirst();
                }
            }
            else
            {
                // このページに関連付けられている、前に保存された状態を復元します
                if (e.PageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null)
                {
                    var selectedItem = await SampleDataSource.GetItemAsync((String)e.PageState["SelectedItem"]);

                    this.itemsViewSource.View.MoveCurrentTo(selectedItem);
                }
            }
        }
        /// <summary>
        /// Füllt die Seite mit Inhalt auf, der bei der Navigation übergeben wird. Gespeicherte Zustände werden ebenfalls
        /// bereitgestellt, wenn eine Seite aus einer vorherigen Sitzung neu erstellt wird.
        /// </summary>
        /// <param name="sender">
        /// Die Quelle des Ereignisses, normalerweise <see cref="NavigationHelper"/>.
        /// </param>
        /// <param name="e">Ereignisdaten, die die Navigationsparameter bereitstellen, die an
        /// <see cref="Frame.Navigate(Type, Object)"/> als diese Seite ursprünglich angefordert wurde und
        /// ein Wörterbuch des Zustands, der von dieser Seite während einer früheren
        /// beibehalten wurde.  Der Zustand ist beim ersten Aufrufen einer Seite NULL.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Ein geeignetes Datenmodell für die problematische Domäne erstellen, um die Beispieldaten auszutauschen
            var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;
        }
Beispiel #12
0
        /// <summary>
        /// Rellena la página con el contenido pasado durante la navegación. Cualquier estado guardado se
        /// proporciona también al crear de nuevo una página a partir de una sesión anterior.
        /// </summary>
        /// <param name="sender">
        /// El origen del evento; suele ser <see cref="NavigationHelper"/>.
        /// </param>
        /// <param name="e">Datos de evento que proporcionan tanto el parámetro de navegación pasado a
        /// <see cref="Frame.Navigate(Type, Object)"/> cuando se solicitó inicialmente esta página y
        /// un diccionario del estado mantenido por esta página durante una sesión
        /// anterior.  El estado será null la primera vez que se visite una página.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Crear un modelo de datos adecuado para el dominio del problema para reemplazar los datos de ejemplo.
            var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;
        }
Beispiel #13
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            //var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);
            var item = await SampleDataSource.GetItemAsync((int)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;

            //get the categoryname for this recipe
            var categoryId = item.Category_Id;
            var category   = await SampleDataSource.GetGroupAsync(categoryId);

            var categoryName = category.Name;

            //display the category name for this recipe in RecipeCategoryName textblock
            RecipeCategoryName.Text = "Cusine : " + categoryName;

            //To show rating as the number of stars
            //Text="{Binding Items[0].Rating}"
            var rating     = item.Rating;
            var ratingtext = "";

            for (int i = 0; i < rating; i++)
            {
                //draw as many stars as the rating in the textblock for rating
                ratingtext += "*";
            }
            RecipeRating.Text = "Rating : " + ratingtext;
        }
Beispiel #14
0
        /// <summary>
        /// Заполняет страницу содержимым, передаваемым в процессе навигации.  Также предоставляется любое сохраненное состояние
        /// при повторном создании страницы из предыдущего сеанса.
        /// </summary>
        /// <param name="sender">
        /// Источник события; как правило, <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Данные события, предоставляющие параметр навигации, который передается
        /// <see cref="Frame.Navigate(Type, object)"/> при первоначальном запросе этой страницы, и
        /// словарь состояний, сохраненных этой страницей в ходе предыдущего
        /// сеанса.  Это состояние будет равно NULL при первом посещении страницы.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Создание соответствующей модели данных для области проблемы, чтобы заменить пример данных
            var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;
        }
Beispiel #15
0
        /// <summary>
        /// Popola la pagina con il contenuto passato durante la navigazione.  Vengono inoltre forniti eventuali stati
        /// salvati durante la ricreazione di una pagina in una sessione precedente.
        /// </summary>
        /// <param name="sender">
        /// Origine dell'evento. In genere <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Dati evento che forniscono il parametro di navigazione passato a
        /// <see cref="Frame.Navigate(Type, object)"/> quando la pagina è stata inizialmente richiesta e
        /// un dizionario di stato mantenuto da questa pagina nel corso di una sessione
        /// precedente.  Lo stato è null la prima volta che viene visitata una pagina.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: creare un modello dati appropriato per il dominio problematico per sostituire i dati di esempio
            var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;
        }
Beispiel #16
0
        /// <summary>
        /// 탐색 중 전달된 콘텐츠로 페이지를 채웁니다. 이전 세션의 페이지를
        /// 다시 만들 때 저장된 상태도 제공됩니다.
        /// </summary>
        /// <param name="sender">
        /// 대개 <see cref="NavigationHelper"/>인 이벤트 소스
        /// </param>
        /// <param name="e">이 페이지가 초기에 요청될 때
        /// <see cref="Frame.Navigate(Type, Object)"/>에 전달되는 탐색 매개 변수와
        /// 이전 세션 동안 이 페이지에 유지된 상태 사전을 제공하는
        /// 이벤트 데이터입니다. 페이지를 처음 방문할 때는 이 상태가 null입니다.< /param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            //var group = await SampleDataSource.GetGroupAsync((String)e.NavigationParameter);
            //this.DefaultViewModel["Group"] = group;
            //this.DefaultViewModel["Items"] = group.Items;

            DataModel.ComicQueryManager comicQueryManager = new DataModel.ComicQueryManager();
            DataModel.ComicQuery        query             = e.NavigationParameter as DataModel.ComicQuery;
            comicQueryManager.UpdateQueryResults(query);
            this.DefaultViewModel["Group"] = query;
            this.DefaultViewModel["Items"] = comicQueryManager.CurrentQueryResults;

            if (e.PageState == null)
            {
                this.itemListView.SelectedItem = null;
                // 새 페이지인 경우에는 논리 페이지 탐색이 사용 중인 경우를 제외하고 첫 번째 항목이
                // 자동으로 선택됩니다(논리 페이지 탐색 #region은 아래를 참조하십시오.)
                if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null)
                {
                    this.itemsViewSource.View.MoveCurrentToFirst();
                }
            }
            else
            {
                // 이 페이지와 관련하여 이전에 저장된 상태를 복원합니다.
                if (e.PageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null)
                {
                    var selectedItem = await SampleDataSource.GetItemAsync((String)e.PageState["SelectedItem"]);

                    this.itemsViewSource.View.MoveCurrentTo(selectedItem);
                }
            }
        }
Beispiel #17
0
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // TODO: Create an appropriate data model for your problem domain to replace the sample data
     try
     {
         string         groupid = (string)e.NavigationParameter;
         SampleDataItem item;
         if (groupid.Contains("Group-0-") || groupid.Contains("Group-1-"))
         {
             item = await SampleDataSource.GetItemAsync1((string)e.NavigationParameter);
         }
         else
         {
             item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);
         }
         this.DefaultViewModel["Item"] = item;
         ContentRoot.Title             = item.Title;
         details.Text = item.Description;
         rules.Text   = item.Content;
         string contact = item.Contacts;
         while (true)
         {
             if (contact.IndexOf(':') == -1)
             {
                 break;
             }
             name.Add(contact.Substring(0, contact.IndexOf(':')));
             contact = contact.Substring(contact.IndexOf(':') + 1);
             phn.Add(contact.Substring(0, contact.IndexOf('\n')));
             try { contact = contact.Substring(contact.IndexOf('\n') + 1); }
             catch (Exception) { break; }
         }
         for (int i = 0; i < name.Count; i++)
         {
             TextBlock contacts = new TextBlock();
             contacts.Foreground   = new SolidColorBrush(Colors.White);
             contacts.FontSize     = 18.0;
             contacts.TextWrapping = TextWrapping.Wrap;
             contacts.Text         = name[i] + ": " + phn[i];
             StackPanel st = new StackPanel();
             st.Orientation = Orientation.Horizontal;
             AppBarButton call = new AppBarButton();
             SymbolIcon   ic   = new SymbolIcon(Symbol.Phone);
             call.Icon   = ic;
             call.Tag    = i;
             call.Click += new RoutedEventHandler(Action_Call);
             AppBarButton msg = new AppBarButton();
             SymbolIcon   ic1 = new SymbolIcon(Symbol.Message);
             msg.Icon   = ic1;
             msg.Tag    = i;
             msg.Click += new RoutedEventHandler(Action_Message);
             st.Children.Add(call);
             st.Children.Add(msg);
             ContactsList.Children.Add(contacts);
             ContactsList.Children.Add(st);
         }
     }
     catch (Exception eq) { }
 }
Beispiel #18
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data.
            //var group = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);
            var group = await SampleDataSource.GetItemAsync(e.NavigationParameter.ToString());

            this.DefaultViewModel["Drivers"] = group;
        }
Beispiel #19
0
        /// <summary>
        /// Populates the page with content passed during navigation. Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>.
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;
            if (item.Title.Equals("Run Hello World"))
            {
                Mat img = new Mat(200, 400, DepthType.Cv8U, 3);
                img.SetTo(new MCvScalar(255, 0, 0));
                CvInvoke.PutText(img, "Hello world.", new System.Drawing.Point(10, 80), FontFace.HersheyComplex, 1.0, new MCvScalar(0, 255, 0));

                ImageView.Source = img.ToWritableBitmap();
            }
            else if (item.Title.Equals("Run Planar Subdivision"))
            {
                Mat img = PlanarSubdivisionExample.DrawSubdivision.Draw(400, 30);
                ImageView.Source = img.ToWritableBitmap();
            }
            else if (item.Title.Equals("Run Face Detection"))
            {
                Mat img = await LoadImage(@"Assets\Images\lena.jpg");

                List <Rectangle> faces = new List <Rectangle>();
                List <Rectangle> eyes  = new List <Rectangle>();
                long             detectionTime;
                FaceDetection.DetectFace.Detect(img, "haarcascade_frontalface_default.xml", "haarcascade_eye.xml",
                                                faces, eyes, false, false, out detectionTime);

                foreach (Rectangle face in faces)
                {
                    CvInvoke.Rectangle(img, face, new Bgr(0, 0, 255).MCvScalar, 2);
                }
                foreach (Rectangle eye in eyes)
                {
                    CvInvoke.Rectangle(img, eye, new Bgr(255, 0, 0).MCvScalar, 2);
                }
                ImageView.Source = img.ToWritableBitmap();
            }
            else if (item.Title.Equals("Run Pedestrian Detection"))
            {
                Mat img = await LoadImage(@"Assets\Images\pedestrian.png");

                Mat gray = new Mat();
                CvInvoke.CvtColor(img, gray, ColorConversion.Bgr2Gray);
                long        detectionTime;
                Rectangle[] pedestrians = PedestrianDetection.FindPedestrian.Find(gray, false, false, out detectionTime);
                foreach (Rectangle pedestrian in pedestrians)
                {
                    CvInvoke.Rectangle(img, pedestrian, new MCvScalar(0, 0, 255));
                }
                ImageView.Source = img.ToWritableBitmap();
            }
        }
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var item = await SampleDataSource.GetItemAsync((String)e.NavigationParameter);

            this.defaultViewModel["Item"] = item;

            var uri = "ms-appx:///Assets/" + item.UniqueId + ".mp4";

            mymedia.Source = new Uri(uri, UriKind.Absolute);
            PageTitle.Text = item.Title;
        }
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var item = await SampleDataSource.GetItemAsync((String)e.NavigationParameter);

            //this.DefaultViewModel["Item"] = item;

            ResultTextBlock.Text = await
                                   new HttpClient().GetStringAsync(
                new Uri("http://www.apress.com/index.php/dailydeals/index/rss"
                        )
                );
        }
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="Common.NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var item = await SampleDataSource.GetItemAsync((String)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;

            //// Load items phone number into the textblock
            //txtPhone.Text = item.Phone;

            //// Load website buttons uri
            //Uri uri = new Uri(item.Website);
            //btnWebsite.NavigateUri = uri;
        }
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            thisTaskInstance = taskInstance;

            // This is for me to remember to mention that Deferral is needed if there are async operations in the background task
            deferral = taskInstance.GetDeferral();

            string ExceptionData = "None";
            try
            {
                // Get reports for geofences state changes
                foreach (GeofenceStateChangeReport report in GeofenceMonitor.Current.ReadReports())
                {
                    GeofenceState state = report.NewState;
                    Geofence geofence = report.Geofence;

                    var item = await SampleDataSource.GetItemAsync(geofence.Id);


                    // If we've entered a particular geofence, show message for that geofence's id
                    if (state == GeofenceState.Entered)
                    {
                        // Show message for the given geofence enter event
                        string geofenceEnterMessage = "BG Approaching " + item.Subtitle;

                        // Create a toast to tell the user about the event
                        SendToastBG(geofenceEnterMessage);
                        // Or do stuff under the covers, such as update info, change something in the phone, send message, etc
                    }

                    // If we've exited a particular geofence, show message for that geofence's id
                    else if (state == GeofenceState.Exited)
                    {
                        // Show message for the given geofence exit event
                        string geofenceExitMessage = "BG Leaving " + item.Subtitle;
                        // Create a toast to tell the user about the event
                        //SendToastBG(geofenceExitMessage);
                        // Or do stuff under the covers, such as check out, change something in the phone, send message, etc
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionData = ex.Message;
            }

            deferral.Complete();
        }
Beispiel #24
0
        /// <summary>
        /// 使用在导航过程中传递的内容填充页。  在从以前的会话
        /// 重新创建页时,也会提供任何已保存状态。
        /// </summary>
        /// <param name="sender">
        /// 事件的来源;通常为 <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">事件数据,其中既提供在最初请求此页时传递给
        /// <see cref="Frame.Navigate(Type, object)"/> 的导航参数,又提供
        /// 此页在以前会话期间保留的状态的
        /// 字典。首次访问页面时,该状态将为 null。</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: 创建适用于问题域的合适数据模型以替换示例数据
            var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;

            this.AddFav.Visibility    = (ReadListUtil.IsFav(item.UniqueId)) ? Visibility.Collapsed : Visibility.Visible;
            this.RemoveFav.Visibility = (ReadListUtil.IsFav(item.UniqueId)) ? Visibility.Visible : Visibility.Collapsed;

            var    resourceLoader = ResourceLoader.GetForCurrentView("Resources");
            string aaa            = resourceLoader.GetString("HTMLContent");

            aaa = aaa.Replace("<!DOCTYPE html><html lang='en' xmlns='http://www.w3.org/1999/xhtml'><head>    <meta charset='utf-8' />    <title></title></head><body>", "<!DOCTYPE html><html lang='en' xmlns='http://www.w3.org/1999/xhtml'><head>    <meta charset='utf-8' />    <title></title></head><body bgcolor='#1f1f1f' text='#ffffff'>");
            this.NewsBrowser.NavigateToString(aaa);
        }
Beispiel #25
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            this.pageMode = ((EditObject)(e.NavigationParameter)).pageMode;
            int    driverId = ((EditObject)(e.NavigationParameter)).Id;
            Driver drv      = new Driver();

            if (pageMode == HelperClass.PageMode.Edit)
            {
                PageTitle.Text = "Edit Driver";
            }

            if (pageMode == HelperClass.PageMode.Edit)
            {
                drv = await SampleDataSource.GetItemAsync(driverId.ToString());
            }

            this.DefaultViewModel["Driver"] = drv;
        }
Beispiel #26
0
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;
            this.InitializeComponent();
            URL = item.URL;

            if (!SampleDataSource.isItemDownloaded)
            {
                MessageDialog CurrentMessageDialog = new MessageDialog("Отсутсвует подключение", "Ошибка");

                CurrentMessageDialog.Commands.Add(new UICommand("Ok", new UICommandInvokedHandler(CurrentMessageDialogHandlers)));
                CurrentMessageDialog.Commands.Add(new UICommand("Обновить", new UICommandInvokedHandler(CurrentMessageDialogHandlers)));

                await CurrentMessageDialog.ShowAsync();
            }
        }
Beispiel #27
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data

            //featured recipe
            var sampleDataItem = await SampleDataSource.GetItemAsync(GetRandomNumber(25));//gets a recipe data with random recipeId

            this.DefaultViewModel["Section1Item"] = sampleDataItem;

            //International Cusine
            var groups = await SampleDataSource.GetGroupsAsync();

            this.DefaultViewModel["Section2Items"] = groups;

            //var sampleDataGroup = await SampleDataSource.GetGroupAsync("Group-4");
            //gets the top rated cusine on a random basis and displays the collection of its recipes
            var sampleDataGroup = await SampleDataSource.GetGroupAsync(GetRandomNumber(5));

            this.DefaultViewModel["Section3Items"] = sampleDataGroup;
        }
Beispiel #28
0
        /// <summary>
        /// 使用在导航过程中传递的内容填充页。  在从以前的会话
        /// 重新创建页时,也会提供任何已保存状态。
        /// </summary>
        /// <param name="sender">
        /// 事件的来源;通常为 <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">事件数据,其中既提供在最初请求此页时传递给
        /// <see cref="Frame.Navigate(Type, object)"/> 的导航参数,又提供
        /// 此页在以前会话期间保留的状态的
        /// 字典。首次访问页面时,该状态将为 null。</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: 创建适用于问题域的合适数据模型以替换示例数据
            if ((string)e.NavigationParameter == "ReadList")
            {
                this.DefaultViewModel["Item"] = await ReadListUtil.GetReadList();
            }
            else if ((string)e.NavigationParameter == "FavList")
            {
                this.DefaultViewModel["Item"] = ReadListUtil.GetFavList();
            }
            else
            {
                var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);

                this.DefaultViewModel["Item"] = item;
                this.AddFav.Visibility        = (ReadListUtil.IsFav(item.UniqueId)) ? Visibility.Collapsed : Visibility.Visible;
                this.RemoveFav.Visibility     = (ReadListUtil.IsFav(item.UniqueId)) ? Visibility.Visible : Visibility.Collapsed;
            }
        }
Beispiel #29
0
        void Details_Click(object sender, RoutedEventArgs e)
        {
            // Navigate to the appropriate destination page, configuring the new page
            // by passing required information as a navigation parameter
            var button = sender as HyperlinkButton;

            if (button != null)
            {
                var parent = button.Parent as FrameworkElement;
                if (parent != null)
                {
                    var uniqueIdBox = parent.FindName("uniqueIdBox") as TextBox;
                    if (uniqueIdBox != null)
                    {
                        var item = SampleDataSource.GetItemAsync(uniqueIdBox.Text);
                        this.Frame.Navigate(typeof(DetailsPage), item.Result);
                    }
                }
            }
        }
Beispiel #30
0
        /// <summary>
        /// method to read uniqueid saved in text file and
        /// change the favourites listview source to read in the apropriate
        /// data linked to that uniqueid in the sampleData.json file
        /// </summary>
        private async void readStuff()
        {
            favViewSource = new ObservableCollection <SampleDataItem>();

            StorageFolder rfolder;
            StorageFile   favList = null;
            string        content = "[]";

            // get data
            try
            {
                rfolder = Windows.Storage.ApplicationData.Current.LocalFolder;
                favList = await rfolder.GetFileAsync(fileName);

                content = await FileIO.ReadTextAsync(favList);
            }
            catch (FileNotFoundException)
            {
                await ShowDialog("File not Found!");
            }

            // set data
            if (content.Length > 0)
            {
                JsonArray favsArray = JsonArray.Parse(content);
                if (favsArray.Count > 0)
                {
                    foreach (JsonValue id in favsArray)
                    {
                        // TODO: Create an appropriate data model for your problem domain to replace the sample data
                        var item = await SampleDataSource.GetItemAsync(id.GetString());

                        favViewSource.Add(item);
                    }
                    lstFavourites.ItemsSource = favViewSource;// set listview source
                }
            }
        }