C # development portal and application (15)-added the scan, image sending, and geographic location functions in the menu,
I have introduced a lot of articles about using C # development portals and applications. Basically, I have encapsulated all the interfaces I can do at the time, and the framework has accumulated many modules and users, recently, it was found that the public platform has added a lot of content, especially the scanning, image sending, and geographic location functions in the custom menu. These function modules are very important, I thought that I could not scan the QR code by adding a function to the public account. Now I can scan the QR code, take a photo, upload, and other functions. This article mainly introduces a series of articles based on my previous framework, this section describes how to integrate and use these new features.
1. Official introduction to several features 1). Scan code to push events
After you click the button, the client starts the scan tool. After scanning the code, the scan result is displayed. (if it is a URL, the scan result is displayed in the URL ), the result of the scan code is sent to the developer, and the developer can send messages.
2) scan the QR code to push the event and the prompt box "receiving messages" appears.
After the user clicks the button, the client will call the scanning tool. After scanning the code, the client will send the result to the developer and collapse the scanning tool, the prompt box "receiving messages" is displayed, and the developer may receive the message.
3). The system photo and video are displayed.
After the user clicks the button, the client starts the System camera. After taking the photo, the client sends the photo to the developer, pushes the event to the developer, and collapse the System camera, you may receive a message from the developer later.
4). A photo or album is displayed.
After the user clicks the button, the client will pop up a selector for the user to choose "photo" or "select from mobile album ". After the user selects this option, the other two processes are followed.
5). The photo album poster is displayed.
After the user clicks the button, the client will call up the album. After the selection operation is completed, the selected photo will be sent to the developer's server, and the event will be pushed to the developer. At the same time, the album will be collapsed, you may receive a message from the developer later.
6). pop up the location selector.
After the user clicks the button, the client starts the geographic location selection tool. After the selection is completed, the client sends the selected geographic location to the developer's server and collapse the location selection tool, you may receive a message from the developer later.
However, note that the new features above only support users of iPhone 5.4.1 and later versions, and users of Android 5.4 and later versions do not respond after clicking the old version, and developers cannot receive event push normally.
2. Test the public number of the new menu Function
In addition to the support of these functional modules, we also added a public number called "menutest" for convenience of our developers. Search for "menutest" in the Public Account and follow it to test several new functions.
/// <Summary> /// menu button type /// </summary> public enum ButtonType {// <summary> /// click /// </summary> click, /// <summary> /// Url /// </summary> view, /// <summary> /// scan the QR code to push events /// </summary> scancode_push, /// <summary> /// scan the QR code to push the event and the event push in the message receiving prompt box is displayed /// </summary> scancode_waitmsg, /// <summary> /// push the system picture sending event // </summary> pic_sysphoto, /// <summary> /// push the photo taking or photo album posting event /// </summary> pic_photo_or_album, /// <summary> /// event push for the photo album poster is displayed /// </summary> pic_weixin, /// <summary> /// event push for the geographical location selector is displayed /// </summary> location_select}
Then, call the create menu operation code in Winform as follows:
Private void btnCreateMenu_Click (object sender, EventArgs e) {MenuJson productInfo = new MenuJson ("new function test", new MenuJson [] {new MenuJson ("Scan code event", ButtonType. scancode_push, "scancode_push"), new MenuJson ("system photos", ButtonType. pic_sysphoto, "pic_sysphoto"), new MenuJson ("photo album photos", ButtonType. pic_photo_or_album, "pic_photo_or_album"), new MenuJson ("album photos", ButtonType. pic_weixin, "pic_weixin"), new Me NuJson ("geographic location selection", ButtonType. location_select, "location_select")}); MenuJson frameworkInfo = new MenuJson ("framework product", new MenuJson [] {new MenuJson ("Win Development Framework", ButtonType. click, "win"), new MenuJson ("WCF Development Framework", ButtonType. click, "wcf"), new MenuJson ("Hybrid Framework", ButtonType. click, "mix"), new MenuJson ("Web Development Framework", ButtonType. click, "web"), new MenuJson ("code generation tool", ButtonType. click, "database2sharp")}); MenuJson RelatedInfo = new MenuJson ("related link", new MenuJson [] {new MenuJson ("Company Profile", ButtonType. click, "event_company"), new MenuJson ("Official Website", ButtonType. view, "http://www.iqidi.com"), new MenuJson ("Contact Us", ButtonType. click, "event_contact"), new MenuJson ("Response System", ButtonType. click, "set-1"), new MenuJson ("manual customer service", ButtonType. click, "event_customservice")}); MenuListJson menuJson = new MenuListJson (); menuJson. bu Tton. addRange (new MenuJson [] {productInfo, frameworkInfo, relatedInfo}); if (MessageUtil. showYesNoAndWarning ("are you sure you want to create a menu?") = System. windows. forms. dialogResult. yes) {IMenuApi menuBLL = new MenuApi (); CommonResult result = menuBLL. createMenu (token, menuJson); Console. writeLine ("create menu:" + (result. success? "Successful": "failed:" + result. ErrorMessage ));}}
Of course, we usually do this in the Web Background system. Maintenance menus are all managed on our own platform, and then submitted to the server at one time.
In the Web Background, you only need to change the database data to Json data for submission, and the operation is similar to the above.
/// <Summary> /// update menu /// </summary> /// <returns> </returns> public ActionResult UpdateWeixinMenu () {string token = base. getAccessToken (); MenuListJson menuJson = GetWeixinMenu (); IMenuApi menuApi = new MenuApi (); CommonResult result = menuApi. createMenu (token, menuJson); return ToJsonContent (result );}
4. Scan function integration
As mentioned above, with the latest features, we can scan the QR code and QR code. With the quick identification of bar code and QR code, we can develop functions such as bar code query and product processing.
Here we will introduce how to integrate this scan function in my development framework.
We have added some test menus for new features. All we need to do is to respond to these events and then process them.
The following describes some API jump processing based on events. We also define several object classes to process their information, such as RequestEventScancodePush, RequestEventScancodeWaitmsg, RequestEventPicSysphoto, and so on.
The code of the RequestEventScancodeWaitmsg object class is as follows.
/// <Summary> /// scan the QR code to push the event and the event push in the message receiving prompt box is displayed. /// </summary> [System. xml. serialization. xmlRoot (ElementName = "xml")] public class RequestEventScancodeWaitmsg: BaseEvent {public RequestEventScancodeWaitmsg () {this. msgType = RequestMsgType. event. toString (). toLower (); this. event = RequestEvent. scancode_waitmsg.ToString (); this. scanCodeInfo = new ScanCodeInfo () ;}/// <summary> /// event KEY value, the developer sets /// </summary> public string EventKey {get; set;} when creating the menu ;} /// <summary> /// scan information /// </summary> public ScanCodeInfo {get; set ;}}
The following describes how to transfer an interface based on the entity type.
Case RequestEvent. scancode_push: {// RequestEventScancodePush info = XmlConvertor. XmlToObject (postStr, typeof (RequestEventScancodePush) as RequestEventScancodePush; if (info! = Null) {responseContent = actionBLL. handleEventScancodePush (info) ;}} break; case RequestEvent. scancode_waitmsg: {// event push RequestEventScancodeWaitmsg info = XmlConvertor. xmlToObject (postStr, typeof (RequestEventScancodeWaitmsg) as RequestEventScancodeWaitmsg; if (info! = Null) {responseContent = actionBLL. handleEventScancodeWaitmsg (info) ;}} break; case RequestEvent. pic_sysphoto: {// push RequestEventPicSysphoto info = XmlConvertor when the system photos and sends images are displayed. xmlToObject (postStr, typeof (RequestEventPicSysphoto) as RequestEventPicSysphoto; if (info! = Null) {responseContent = actionBLL. HandleEventPicSysphoto (info) ;}} break;
..................
The final code returned after processing the scan result is as follows.
/// <Summary> /// process the event push in the message receiving prompt box displayed. /// </summary> /< param name = "info"> scan Information </param> // <returns> </returns> public string HandleEventScancodeWaitmsg (RequestEventScancodeWaitmsg info) {ResponseText response = new ResponseText (info); response. content = string. format ("your information is: {0}. You can query data in the background. ", Info. ScanCodeInfo. ScanResult); return response. ToXml ();}
Finally, we will test and scan a bar code to see the returned result interface. The operations are as follows.
5. Problems found during the test of the new menu Function
I have introduced the integration of some new menu function modules. I personally appreciate this menu scanning function, which is also a trend of gradually integrating more hardware resources and interface processing, however, during integration and use, it is found that the public account occasionally experiences a crash. Some of these new features, although the backend can process and receive data, cannot return a response message, very depressing. These functions may soon be improved and solved as the development of the version accelerates.
In addition, the open platform has also been put into use, and some certification is also 300 yuan a year, but there is no application scenario for the moment, I just used it to obtain the unionid function of the account, learn more about other functions.
There is also the enterprise number that has already come out, and I have already applied for certification, and there are a lot of APIS for its development users. If you have time, continue to study and integrate it into the development framework.
C :\
Yes
Refer to this to clean up the C drive:
1. Disable System Restoration: My computer properties/System Restoration/disable System Restoration on all disks, but I will not be able to use system restoration in the future!
2. Disable System sleep: Control Panel/Power Supply/sleep/remove the check before starting system sleep
3. move the virtual memory, my computer properties/advanced/performance/settings/advanced/change/select the C disk, that is, the system disk, select the no-score page, and then set the virtual memory to its disk, A disk with more disk space remaining, such as D, E, and F. set to 1.5 ~ of memory ~ 2.5 times. The size can be set to the same!
5. Clear temporary IE folders, internet Options, and delete temporary and offline files.
6. delete system logs and program logs, my computer/control panel/management tools/Computer Management/Event Viewer/application, right-click/clear events, and clear system logs in sequence
7. Clear system cache: 2000 all files in the system: C: \ WINNT \ system32 \ dllcache
The XP system is: C: \ windows \ system32 \ dllcache all files under the system cache (open my computer/tool/file and Folder Options/hide the protected system file hook off to hide all files on the hook) ). You can also run the sfc.exe/purgecache command to automatically delete the file.
8. Clear the recycle bin
9. delete the files under c: \ windows \ SoftwareDistribution \ Download (the files downloaded when the system is updated are useless if you have installed the updates)
10. Delete all directories under c: \ windows \ RegisteredPackages
11. Delete all Files under C: \ WINDOWS \ Downloaded Program Files
12. view the hidden files that are known to be protected by the system in my computer folder option, and check all the files.
13. Delete c: \ windows \ All files with $8882305 $ (backup files after system update)
Zhidao.baidu.com/question/11035955.html
Zhidao.baidu.com/question/12223613.html
Zhidao.baidu.com/question/14874715.html
... The remaining full text>
C :\
Yes
Refer to this to clean up the C drive:
1. Disable System Restoration: My computer properties/System Restoration/disable System Restoration on all disks, but I will not be able to use system restoration in the future!
2. Disable System sleep: Control Panel/Power Supply/sleep/remove the check before starting system sleep
3. move the virtual memory, my computer properties/advanced/performance/settings/advanced/change/select the C disk, that is, the system disk, select the no-score page, and then set the virtual memory to its disk, A disk with more disk space remaining, such as D, E, and F. set to 1.5 ~ of memory ~ 2.5 times. The size can be set to the same!
5. Clear temporary IE folders, internet Options, and delete temporary and offline files.
6. delete system logs and program logs, my computer/control panel/management tools/Computer Management/Event Viewer/application, right-click/clear events, and clear system logs in sequence
7. Clear system cache: 2000 all files in the system: C: \ WINNT \ system32 \ dllcache
The XP system is: C: \ windows \ system32 \ dllcache all files under the system cache (open my computer/tool/file and Folder Options/hide the protected system file hook off to hide all files on the hook) ). You can also run the sfc.exe/purgecache command to automatically delete the file.
8. Clear the recycle bin
9. delete the files under c: \ windows \ SoftwareDistribution \ Download (the files downloaded when the system is updated are useless if you have installed the updates)
10. Delete all directories under c: \ windows \ RegisteredPackages
11. Delete all Files under C: \ WINDOWS \ Downloaded Program Files
12. view the hidden files that are known to be protected by the system in my computer folder option, and check all the files.
13. Delete c: \ windows \ All files with $8882305 $ (backup files after system update)
Zhidao.baidu.com/question/11035955.html
Zhidao.baidu.com/question/12223613.html
Zhidao.baidu.com/question/14874715.html
... The remaining full text>