The battle of programs is so cute that it makes you bleed!

The battle of programs is so cute that it makes you bleed!

I am very happy that my first blog has received widespread praise and was fortunately selected as an editor's recommendation. It seems that not only is my life as a programmer quiet and happy, but my blogging career is also quiet and good! I will still post my masterpiece: "The Quiet Joy of a Programmer's Life". I still have to be high-profile, just in case it becomes popular? Don't you agree?

1. Introduction

The program in everyone's eyes is first like this:

  1. namespace OMCS.Passive
  2. {
  3. // Summary:  
  4. // Basic interface of multimedia device manager. Used to manage all local multimedia devices.  
  5. public   interface IMultimediaManager : IDisposable
  6. {
  7. //  
  8. // Summary:  
  9. // Whether to automatically adjust the video encoding quality based on audio feedback and video frame loss.  
  10. bool AutoAdjustCameraEncodeQuality { get; set; }
  11. //  
  12. // Summary:  
  13. // Whether to automatically reconnect after disconnection.  
  14. bool AutoReconnect { get; set; }
  15. //  
  16. // Summary:  
  17. // Voice and video chat group entry.  
  18. IChatGroupEntrance ChatGroupEntrance { get; }
  19. //  
  20. // Summary:  
  21. // Whether to output the audio collected by the microphone to the Guest.  
  22. bool OutputAudio { get; set; }
  23. //  
  24. // Summary:  
  25. // Whether to output the desktop image to the Guest. The default value is true.  
  26. bool OutputDesktop { get; set; }
  27. //  
  28. // Summary:  
  29. // Whether to output the video collected by the camera to the Guest. The default value is true.  
  30. bool OutputVideo { get; set; }
  31. //  
  32. // Summary:  
  33. // When the channel is busy, the video frames taken (from the camera) are discarded by the model. The default value is DiscardWhenNeed.  
  34. FrameDisardedMode VideoFrameDisardedMode { get; set; }
  35. //  
  36. // Summary:  
  37. // The audio frame just captured from the microphone.  
  38. event CbGeneric< byte []> AudioCaptured;
  39. //  
  40. // Summary:  
  41. // The audio frame just played.  
  42. event CbGeneric< byte []> AudioPlayed;
  43. //  
  44. // Summary:  
  45. // Establish a connection with the multimedia server and initialize the local multimedia manager. If the connection with the server fails, a network exception will be thrown.  
  46. void Initialize(string userID, string password, string serverIP, int serverPort);
  47. //  
  48. // Summary:  
  49. // Is the P2P channel established with the target user?  
  50. bool IsP2PChannelExist(string destUserID);
  51. }
  52. }

But you don't know that they are actually like this in my eyes——

2. Program Wars

1. The so-called: "OMCS multimedia manager, used to manage all local multimedia devices." Actually means this:

2. The so-called Boolean type attributes are actually switches, like this:

2. The so-called method is actually a button, like this:

3. The so-called events are actually slots, like this:

4. The so-called Boolean read-only attributes are actually indicator lights, like this:

5. The other four connectors can be like this:

3. Cute and bloody

Finally, assemble all the parts together to form an OMCS client. Isn’t it cute?

By using figurative thinking, we can make the originally abstract, boring and meticulously analyzed code become fresh, vivid and interesting. You can also learn from it when understanding the program.

<<:  Some tips for iOS development

>>:  Facebook launches virtual robot assistant 'M'

Recommend

Samsung acquires SmartThings to become the Google of the smart home

With the decline of old mobile phone giants, Sams...

The most comprehensive e-commerce operation plan for you!

What should a qualified e-commerce operation look...

Summary of common commands for Android ADB development

Adb is a very commonly used command for debugging...

Like function, use MySQL or Redis

The like function is a basic function in current ...

Community operation: How to create a community marketing campaign?

How to use the five-step method of social marketi...

How do operators follow hot spots? Share 4 points!

Today I will mainly share my experience and opera...

Mercedes-Benz parent company's profit dropped by 37% as sales in China slowed

According to the Wall Street Journal on the 29th,...