Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone



Clound SSD Virtual Server

Windows Phone SystemTray and ProgressIndicator

Windows Phone SystemTray and ProgressIndicator สำหรับ SystemTray บน Windows Phone เป็นตำแหน่งที่เรียกซึ่งจะอยู่บนเหนือ Titlebar อยู่ติดกับพวกแบตเตอร์รี่ หรือ สัญญาโทรศัพท์ และใน SystemTray เราสามารถสร้าง ProgressBar แบบ ProgressIndicator (IsIndeterminate) ลักษณะเป็น ลูกบอลเล็ก ๆ หมุ่นไปมา เหมาะสำหรับแสดงผลในขณะที่โปรแกรมกำลังโหลดข้อมูล หรือ กำลังทำงานอยู่ และเราสามารถเขียนโปรแกรมเพื่อควบคุม ProgressIndicator ได้ง่าย ๆ เช่น

Windows Phone SystemTray and ProgressIndicator


การแสดง(Show) SystemTray ProgressIndicator

VB.NET
        prog = New ProgressIndicator()
        prog.IsVisible = True
        prog.IsIndeterminate = True
        prog.Text = "Downloading...."

        SystemTray.SetProgressIndicator(Me, prog)

C#
prog = new ProgressIndicator();
prog.IsVisible = true;
prog.IsIndeterminate = true;
prog.Text = "Downloading....";

SystemTray.SetProgressIndicator(this, prog);


การซ่อน(Hide) SystemTray ProgressIndicator

VB.NET
        prog.IsVisible = False

C#
        prog.IsVisible = false;


Example การแสดง Progress แบบ ProgressIndicator บน SystemTray แบบง่าย ๆ

ออกแบบหน้าจอและ Layout ดังรูป ซึ่งประกอบด้วย Button 2 ตัวคือ Start และ Stop

Windows Phone SystemTray and ProgressIndicator

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <Button Content="Start" Height="72" Name="btnStart" Width="160" Click="btnStart_Click" Margin="44,268,252,267" />
            <Button Content="Stop" Height="72" Margin="238,268,58,267" Name="btnStop" Click="btnStop_Click" Width="160" />
        </Grid>

    </Grid>









VB.NET
    Dim prog As ProgressIndicator

    Private Sub btnStart_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
        SystemTray.SetIsVisible(Me, True)
        'SystemTray.SetBackgroundColor(Me, Colors.Blue)
        'SystemTray.SetForegroundColor(Me, Colors.Yellow)

        prog = New ProgressIndicator()
        prog.IsVisible = True
        prog.IsIndeterminate = True
        prog.Text = "Downloading...."

        SystemTray.SetProgressIndicator(Me, prog)
    End Sub

    Private Sub btnStop_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
        prog.IsVisible = False
    End Sub


C#
        ProgressIndicator prog;
        private void btnStart_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            SystemTray.SetIsVisible(this, true);
            // SystemTray.SetBackgroundColor(Me, Colors.Blue)
            // SystemTray.SetForegroundColor(Me, Colors.Yellow)
            prog = new ProgressIndicator();
            prog.IsVisible = true;
            prog.IsIndeterminate = true;
            prog.Text = "Downloading....";
            SystemTray.SetProgressIndicator(this, prog);
        }

        private void btnStop_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            prog.IsVisible = false;
        }


Code ที่เป็น VB.NET และ C#

Screenshot

Windows Phone SystemTray and ProgressIndicator

ทดสอบการทำงานด้วยการคลิกที่ Start

Windows Phone SystemTray and ProgressIndicator

แสดง SystemTray and ProgressIndicator และกดปุ่ม Stop เพื่อหยุดการทำงาน








สำหรับ SystemTray ProgressIndicator เหมาะสมสำหรับการแสดงในขณะที่โปรแกรมกำลังทำงานหรือโหลดข้อมูล เช่นในขณะที่กำลังโหลดข้อมูลจาก Server ก็อาจจะโชว์ ProgressIndicator เพื่อให้ผู้ใช้ทราบว่ากำลังมีการโหลดข้อมูล และเมื่อโหลดข้อมูลเสร้จสิ้นแล้วก็ให้ซ่อน ProgressIndicator ออกจากหน้าจอ Application

   
Share


ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2012-09-05 22:03:00 / 2017-03-25 21:53:15
  Download : Download  Windows Phone SystemTray and ProgressIndicator
 Sponsored Links / Related

 
Windows Phone Slider Progress and Media Player (Slider MediaElement)
Rating :

 
Windows Phone Image Source From URL(Website) Download and ProgressBar
Rating :

 
Windows Phone Media Player (MediaElement) and DownloadProgress (URL,Website)
Rating :

 
Windows Phone Open URL(Website) Web Browser (WebBrowser,IsIndeterminate Progress)
Rating :

 
Windows Phone and ProgressBar Using Thread/Multiple Thread (Silverlight)
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่