2015-09-07

[UWP] Windows 10 IoT 製作一個小小的Server.


目前10240 版本中,還沒有IIS ,本來想說可以寫一些網頁來控制的,不過目前網路上看官方的一些範例,是可以透過自己實作一個httpD ,所以我也動手實作看看,當然我改寫了一部分,我直接讓他可以讀取專案下面 Assets\html\ 的所有檔案

2015-09-04

[UWP] Windows 10 IoT App Service 簡單實作

最近在測一些東西會用到App Service ,在這邊碰到一些壁,所以我在這邊筆記一下,希望可以幫到其他碰到的人,這邊先謝謝Pou 感謝他幫我補充一些觀念跟協助我找到問題
1.講解一下案例,我會註冊一個App Service 當她被呼叫的時候會跳出Notification 的提醒,首先我們先建立專案 ,我們先建立背景執行的部分
Image 124

2015-09-02

[UWP] 在Windows Phone 10 or Win10 中透過 UDP 接收資料

這寫法在目前Window 10 IoT 10.0.10240.16384 上面測試過是正常的,然後再Window Phone 10 目前上面測試也是正常的
目前範例 按下按鈕後,會打開Port 1947 ,透過UDP接收資訊,收到後會用Dialog 跳出來..

wp_ss_20150902_0008

2015-09-01

[UWP] Windows.Storage StorageFolder & FileIO 寫入文字讀取文字


最近在看 Universal Windows Platform 的東西,之前都是用isolated storage ,但是最近看到官方文件寫到



Isolated storage is not available for Windows Store apps. Instead, use the application data classes in the Windows.Storagenamespaces included in the Windows Runtime API to store local data and files. For more information, see Application data in the Windows Dev Center.



所以就乾脆改變紀錄的方法,其實,透過Windows.Storage他存放的位置跟之前Isolated Storage 位置差不多 基本上只是多一層,目前我測試位置是



C:\Users\[USERNAME]\AppData\Local\Packages\[APPID]\LocalState\

2015-08-31

[Winform] 筆記一下,C#透過UDP 接收資料

上一篇文章 [Winform] 筆記一下,C#透過UDP 傳送資料 傳送了資料,那如何接受透過UDP接受資料呢?
一樣這一篇是屬於C# Winform or Console 透過  System.Net 的做法,新的UWP 是不能用的,不過當你需要測試時候就很好用,範例是,一直不斷Port 1947 的所有訊息,並且Text Encoding  是 UTF8
首先先撰寫接收的程式,因為是一值不斷地在聽牌,所以是要寫while(true) 的作法


/// <summary>
  /// UDP Client
  /// </summary>
  UdpClient udpClient = new UdpClient(1947);
 
  /// <summary>
  /// UDP 一直接收Port 1947 的資料,收到後跳Messagebox
  /// </summary>
  private void ThreadRunMethod()
  {
 
      while (true)
      {
          var remoteIp = new IPEndPoint(IPAddress.Any, 0);
 
          var receivedBytes = udpClient.Receive(ref remoteIp);
 
          if (receivedBytes == null || receivedBytes.Length == 0)
              return;
          string strReceiveStr = Encoding.UTF8.GetString(receivedBytes);
          MessageBox.Show("收到資料囉: " + strReceiveStr);
      }
  }

[Winform] 筆記一下,C#透過UDP 傳送資料


先說好,這是 C# Winform or Console 透過  System.Net 的做法,新的UWP 是不能用的,但是因為最近在測試Windows 10 IoT 的東西,所以我得在電腦端這邊寫測試程式紀錄一下

1.首先,要先using


using System.Net;
using System.Net.Sockets;
using System.Text;

2.這邊範例是 傳給 IP 為 192.168.6.100 , Port : 1947 , 中文字 許當麻 , Encoding : UTF8


var socket = new Socket(AddressFamily.InterNetwork,
    SocketType.Dgram,ProtocolType.Udp);
 
var serverAddr = IPAddress.Parse("192.168.6.100");
 
var endPoint = new IPEndPoint(serverAddr, 1947);
 
string text = "許當麻";
byte[] sendByte = Encoding.UTF8.GetBytes(text);
 
socket.SendTo(sendByte, endPoint);

2015-08-28

[IoT] Windows 10 IoT on Raspberry Pi Wifi 問題小記錄


現在有線網路越來越少,結果網路上看文件http://ms-iot.github.io/content/en-US/win10/SetupWiFi.htm
結果我眼殘沒有看到原來TP-LINK WN725N 是支援 MinnowBoard Max
Image 103

2015-08-27

[Xamarin] Xamarin Form 初體驗

最近在看一下Xamarin 官方的文件看到一個應該不算新發表,但是很有趣的東西 就是Xamarin Form
Image 096

2015-08-26

[Xamarin] 透過 SurfaceView 取得相機影像

今天筆記一下之前跌蠻多地方的SurfaceView ,主要目的是取道相機的影像,當然中間還要經過一些處理不過這篇Blog不會記錄那些處理的部份,介紹一下今天範例,主要就是一個SurfaceView   , APP 打開後會呈現相機中的畫面,不過我希望這SurfaceView是以 高:寬 – 4:3 呈現
1. 畫面介紹,只有一個 SurfaceView 基本上就是盡量簡單,打開APP後就會出現相機畫面
Image 093

2015-08-25

關於如何將 office word 變成限定Administrator 執行


上一篇文章 關於如何將Execl 變成限定Administrator 執行 我們用了三個方法讓Excel 執行起來,但是如果你要改word 你會發現 他並沒有 winword.exe.manifest,這時候我們要用點小技巧

1.上篇文章我們不是改過 excel.exe.manifest 的內容,這時候我們複製這檔案變成 winword.exe.manifest 其內容為


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <noInherit></noInherit>
    <assemblyIdentity version="11.0.0.0" processorArchitecture="*" name="excel" type="win32"></assemblyIdentity>
    <description>Microsoft Excel</description>
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel>
            </requestedPrivileges>
        </security>
    </trustInfo>
    <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
        <application>
            <!--The ID below indicates application support for Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
            <!--This Id value indicates the application supports Windows 8 functionality-->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
            <!-- This Id value indicates the application supports Windows 8.1 functionality-->
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
            <!-- This Id value indicates the application supports Windows 10  functionality-->
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
        </application> 
    </compatibility>
    <asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
        <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
            <dpiAware>true</dpiAware>
        </asmv3:windowsSettings>
    </asmv3:application>
</assembly>

關於如何將Execl 變成限定Administrator 執行


筆記一下,如何將Excel 限定 Admonistrator 執行,我的作業環境是Windows 10 + office 2016 所以如果你的環境跟我不同,你就要自己找尋一下執行路徑

方法1 :  對執行檔案按下滑鼠右鍵,就可以以系統管理員身分執行,這方法最簡單
Image 076

[Xamarin] 上傳檔案/圖片 到Server 端 (Android 端)


上篇文章 [Xamarin] 上傳檔案/圖片 到Server 端 (Server 接檔案端)  我們從Server可以收檔案,現在就是Client 端的部分,我們要把圖檔上傳
1. 介紹畫面,按下按鈕後我們會把Assets/ld.jpg 傳到 server 上面
Image 074

[Xamarin] 上傳檔案/圖片 到Server 端 (Server 接檔案端)


蠻常會用到的就是上傳檔案/圖片到Server端,所以筆記一下,首先筆記一下Server Site 的Code
首先開的檔案是 risivfile.ashx
Image 073
開啟檔案後就是Code 的部分,下面的Code 我已經盡量精簡化,簡單的說就是會把收到的東西存成sample.jpg

2015-08-24

[Xamarin] Android 簡單播放mp4 影片筆記

筆記一下,在Xamarin 中在Android 裡播放mp4影片檔,接下來有三個筆記三個項目
1. 播放線上的mp4 網址


FindViewById<Button>(Resource.Id.btnPlay).Click += delegate
{
    //設定播放網址
    videoView.SetVideoURI(Uri.Parse("http://techslides.com/demos/sample-videos/small.mp4"));
 
    //Seek 到第0秒
    videoView.SeekTo(0);
 
    //開始撥放
    videoView.Start();
};

記得要開INTERNET 的 PERMISSION 這邊操控是沒有啥困難的 ..