C # Small memorandum,

Source: Internet
Author: User

C # Small memorandum,
I. Brief Introduction

Memos, I believe they have been used in our daily lives, such as note taking and cell phone memos. These are the things we want to do on a regular basis when we are inspired, let's talk about my memo. My memo function also refers to the addition, deletion, modification, and query operations. It's very easy to add the reminder and audio playback content, but it's practical. Well, let's look at the design.

 

Ii. Design

1. Database Design

The database uses SQLite.

Database tables: Sys_Kind, Memorandum

Sys_Kind is a general dictionary table, which is helpful for beginners, such:

 

Resolution: ID Needless to say, the auto-increment identifier, K_Name: dictionary name, K_Parent: parent type identifier, that is, if K_Parent is 0, It is a type, then the sub-dictionary uses it as the parent class. This field can be used to type the value of the parent class ID. K_Sort sorting means sorting of a single type, or you can sort all the data as rows, k_AddTime is added to the K_Desc dictionary, so that later users can see what this is for. K_State dictionary status can be flexibly applied, it is important to check whether a dictionary or other multi-state code value can be displayed. This value is used as the dictionary value. Many may ask, why don't we use auto-increment IDs, because if there are many types, this ID value will become larger and larger. There are only a few types of values that you define, and their values are still so large, why? The table next to it is a memorandum table. I will not explain it, so I will understand it slowly.

2. Programming ()

As we all know, HA is an ordinary addition, deletion, modification, and query, with no technical content.

 

Iii. Core Technologies

1. Automatic query of memos

I believe everyone knows that the Timer control can be used, but the Timer control can be used. Of course, here I am not using the Timer control, but the System. threading. timer this class, of course, need to understand the related usage, You Can Baidu search, you can also go here https://msdn.microsoft.com/zh-cn/library/system.threading.timer (v = vs.110 ). take a look at aspx. Of course, I also post the code for your reference.

// Declare a delegate private delegate void SetTimerLogicCallback (); // declare a Timer class private System. threading. timer threadTimer; // Method for executing the delegate. ShowMemorandumInfo is the method for querying the database. private void ThreadMethod (object obj) {SetTimerLogicCallback timerLogic = new SetTimerLogicCallback (ShowMemorandumInfo); this. invoke (timerLogic);} // <summary> // set the timer, this method or code can be written in the form when loading /// </summary> private void TimerSet () {threadTimer = new System. threading. timer (new System. threading. timerCallback (ThreadMethod), null, 0, 1000 );}

2. Speech broadcast content

I have used two technologies. One is Microsoft's built-in System. speech. synthesis. the second class of SpeechSynthesizer speech recognition is the speech recognition interface provided by Baidu. Why are two speech recognition interfaces used? If there is no network on our user machine, we can use the speech recognition function provided by Microsoft, if Microsoft Speech Recognition is not installed on the user machine, you can use Baidu's Speech Recognition interface. If Microsoft Speech Recognition is not installed on the machine or on the machine, then you can package the program to automatically install Microsoft's own voice recognition installation package or other plug-ins or components. Of course, this installation package must be much larger than your program. It is estimated that besides xp, few of win7's speech recognition products are not automatically installed. Well, the following code is used:

/// <Summary> /// Microsoft Speech Recognition /// </summary> /// <param name = "content"> content </param> public static void SpeakAsync (string content) {try {if (synth! = Null) synth. dispose (); synth = new System. speech. synthesis. speechSynthesizer (); synth. speakAsyncCancelAll (); synth. speakAsync (content) ;}catch (Exception ex) {throw ex ;}/// <summary> // Baidu speech synthesis (document Website: http://yuyin.baidu.com/docs/tts/197) /// </summary> private void BaiduTts (string audioText) {_ ttsClient = new Baidu. aip. speech. tts ("API_KEY", "SECRET_KEY"); // optional parameter var option = new Dictionary <string, object> () {"spd", 5 }, // speech speed {"vol", 7}, // volume {"per", 4} // speaker, 4: emotional voice}; var result = _ ttsClient. synthesis (audioText, option); if (result. errorCode = 0) {string fileName = Application. startupPath + "\" + Guid. newGuid (). toString () + ". mp3 "; System. IO. file. writeAllBytes (fileName, result. data); axWindowsMediaPlayer1.URL = fileName; axWindowsMediaPlayer1.Ctlcontrols. play (); System. IO. file. delete (fileName);} else {Utils. logMessage ("Baidu speech synthesis exception", result. errorMsg );}}

 

Summary: this is a simple memorandum program. You are welcome to study it for beginners. You can just take a look at it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.