Edi Wang

.NET and Azure Developer

Windows Development UWP, WPF, WinForm, etc

UWP App for the Raspberry Pi Azure Surveillance Camera

I wrote a post about Raspberry Pi Surveillance Camera with Linux and Azure, it was using an ASP.NET website for displaying the photos. I made an UWP client App these days, you can download from here https://www.microsoft.com/store/apps/9nblgggzfnv0 (Because WP is already finished, so I don't provide Windows 10 Mobile package) It doesn't allow upload photos, because the photos should all come …
MVVM Binding

Windows 10 UWP开发:拼音首字母分组如何去掉“拼音”前缀并支持切换系统语言

Windows 10里面有个脑残设计,就是系统默认的CharacterGroupings类型在中文版系统上会产生除了A-Z字母以外的带“拼音”前缀的另外24个分组。比如开屎菜单里就是这样: 如果我们用这个CharacterGroupings类型去创建带分组的ListView,就会变成这样: 更蛋疼的是,如果用户的系统是英文语言的,他就会发现分组变成空白了,没有任何数据。用户不知道这是微软干的,又得给我们的APP打1星,还要骂我们傻逼。 今天经过研究,终于把这个问题给解决了,不仅去掉了“拼音”前缀,也不用担心用户系统是什么语言的,都能正常显示分组列表。 我们先看看原来的代码。 public class AlphaKeyGroup<T> : List<T> { const string GlobeGroupKey = "?"; …
Windows UWP

Sharing Images in Windows 10 UWP

Starting from Windows 8, one big feature for Windows Store Apps is to share data using Charm Bar across Apps. Although the Charm Bar is removed in Windows 10, but the API for sharing is still in the fight.  For example, in my "Image Portray" App, I can share ink to OneNote or Outlook. Today, I added same capability for my "Shanghai Metro" App. Here's how to do it. First, to share data across …
Windows UWP

Reed Controlled Light by Windows 10 IoT Core

Reed switch is an electronic component to connect / disconnect the switch by magnetic field. When it touchs magnetic field, the two iron sheets inside the tube will clip together, so the switch is connected.  The application of Reed Swith: Door light controller: When you open the door, turn the light on. When you close the door, turn off the light. This is simply install a reed switch on your …
Windows IoT Raspberry Pi

74HC595 4 Digits LED Tube with Windows 10

One of the commonly used LED Tube driver chip is 74HC595, by using the Chip, you can save GPIO ports. I bought an LED Tube with 595 chip, it only needs 3 GPIO ports to display 4 digits. However, there is no existing posts about how to drive the 74HC595 LED Tube from Windows 10. So, I can only try for myself. …
Windows IoT Raspberry Pi

Using stepper motor in Windows 10 IoT Core

如果你需要精确控制设备的转动角度,普通电机是做不到的,通常我们会选用步进马达。比如28BYJ-48这个型号的,很容易买到。 步进马达得配合驱动板使用,最常用的是ULN2003芯片的驱动板,就像下图。不过注意,你买到的驱动板长相可能不太一样,不过没关系,只要芯片上写的是ULN2003,就可以使用,它们的接口都是一样的。关于步进马达的原理,可以看这篇: https://en.wikipedia.org/wiki/Stepper_motor  拿到驱动板和步进马达后,将马达插入驱动板的白色插槽中,这个接口有防呆设计,所以不会插反。 关于Windows 10 IoT如何驱动步进马达,有一篇很好的英文材料: https://www.hackster.io/erickbp/stepper-motor-and-windows-10-iot-core-d3c5d6 我的例子就是基于上面这 …
Windows IoT Raspberry Pi

Sound Controlled Light by Windows 10 IoT Core

In many buildings, there are sound controlled light in use. When you clap your hands, the light turns on. Now, with Raspberry Pi 3 and Windows 10 IoT, we can make a sound controlled light ourselves. The sound sensor I use is FC-04. As other sensors, the first step is calibration. 1. Calibration for FC-04 Sound Sensor In quiet environment. Connect VCC to DC 3.3V,GND to Ground. At that time, the …
Windows UWP IoT Raspberry Pi

Windows 10 IoT: Detect Range with HC-04 Ultrasonic Sensor on Raspberry Pi 3

HC-04是树莓派上用的比较广泛的超声波传感器,可以用来测量设备和物体之间的距离。可惜网上的资料很少有针对Windows 10的,几乎都是Python和C在Linux上的例子。 hackster.io上有一篇用HC-04做雷达的例子,但是设计的部件太多了,对单纯学习HC-04传感器的使用来说这个例子比较复杂。搜了一圈,英文资料最好的是这篇:http://www.guruumeditation.net/en/digital-io-with-windows-10-iot-raspberry-pi-2-and-the-ultrasonic-ranging-module-hc-sr04/ 国内中文资料介绍Windows 10上HC-04传感器的文章似乎还没有,所以就简单总结一下步骤。 一、物理连接 对于没有多少物理和电子知识基础的人(比如我)来说,第一步连线是比较难的。很多文章都一笔带过说“这很 …
Windows UWP IoT Raspberry Pi

Windows 10 IoT Development: Moisture Sensor for Raspberry Pi 3

I bought a moisture sensor like this recently. After some research, there seem no articles to indicate how to use it in Windows 10. So I figured out myself. This sensor has 4 Pins, which are: PIN Usage AO Analog Out DO  Digital Out GND  Ground  VCC  Power So, let's connect VCC to DC3.3v on RPi, I use PIN 01. Connect GND to any ground header, which I use …
Windows UWP IoT Raspberry Pi

GY-30 (BH1750FVI) Light Sensor with Windows 10 IoT

I purchased a GY-30 light sensor recently, this model is also known as "BH1550FVI". There seems no sample for this sensor on Windows 10 yet, so I tried to make one. The light sensor looks like this: My board is a Raspberry Pi 3, the GPIO layout is shown in this table: Because GY-30 is an I2C device, so we can not use GPIO to drive it directly, we must use the I2C ports. In addition, …
Windows UWP IoT Raspberry Pi