Home  >  Article  >  Backend Development  >  C# implements network electronic whiteboard and courseware functions (online teaching system)

C# implements network electronic whiteboard and courseware functions (online teaching system)

little bottle
little bottleforward
2019-04-10 10:15:044023browse

Nowadays, with the rapid development of Internet technology, online teaching is also very popular, and electronic whiteboard and courseware functions are essential functions in online teaching systems. This article introduces how to quickly implement them based on OMCS Basic functions of the electronic whiteboard, as well as courseware functions: advanced functions such as uploading courseware, opening courseware, turning pages of courseware, synchronizing courseware, deleting courseware, etc.

The application scenario of this article is as follows: A teacher and N students enter the same classroom, so they will see the same electronic whiteboard. The difference between the teacher role and the student role is that the teacher has special whiteboard permissions. These permissions include: uploading courseware, opening courseware, deleting courseware, drawing on the whiteboard, annotating, turning pages, etc.

1. Server

The server directly moves the OMCS.Server project source code provided by OMCS.Boost without any modification.

2. Client

1. Realize the conversion of courseware to pictures

The most common types of whiteboard courseware are: word, pdf, and ppt documents. Therefore, First of all, we need to implement the IImageConverter interface to convert pdf, ppt, and word documents into images. Correspondingly, we designed three classes: Word2ImageConverter, Pdf2ImageConverter, and Ppt2ImageConverter. Their specific implementation codes can be viewed in the source code of the Demo.

Then, we have to implement the IImageConverterFactory factory interface:


##

    public class ImageConverterFactory : IImageConverterFactory
    {        public IImageConverter CreateImageConverter(string extendName)
        {            if (extendName == ".doc" || extendName == ".docx")
            {                return new Word2ImageConverter();
            }            if (extendName == ".pdf")
            {                return new Pdf2ImageConverter();
            }            if (extendName == ".ppt" || extendName == ".pptx")
            {                return new Ppt2ImageConverter();
            }            return null;
        }        public bool Support(string extendName)
        {            
return extendName == ".doc" || extendName == ".docx" || extendName == ".pdf" || extendName == ".ppt" || extendName == ".pptx";
        }
    }

Then, when the program starts, inject the factory into the multimedia manager (IMultimediaManager) of OMCS:


    IMultimediaManager multimediaManager = MultimediaManagerFactory.GetSingleton();
    multimediaManager.ImageConverterFactory = new ImageConverterFactory();
    // 图片转换器工厂,供OMCS内部将课件转换成图片的过程中使用。
2. Differentiate roles when logging in: teacher, student

The client login interface design is as follows:

Depending on the selected role, you will have different permissions when entering the whiteboard, which is mainly reflected in the two attribute settings of the whiteboard connector:


     public WhiteBoardForm(string classRid, bool isTeacher )
    {
        InitializeComponent();            
           
        this.classRoomID = classRid;        
        this.whiteBoardConnector1.IsManager = isTeacher;        
        this.whiteBoardConnector1.WatchingOnly = !isTeacher;        
        this.Text = string.Format("正在访问{0}的电子白板" ,this.classRoomID);        
        this.whiteBoardConnector1.ConnectEnded += new CbGeneric7bbd801570934dd5b105aa5e8751cf99(whiteBoardConnector1_ConnectEnded);           
        this.whiteBoardConnector1.BeginConnect(this.classRoomID);            
    }
IsManager attribute is used It is used to control whether you have permission to upload courseware, open courseware, delete courseware, etc.

The WatchingOnly property is used to control whether the user can draw images on the whiteboard and other operations.

In this demo, the effect of our settings is that the teacher can operate the courseware, draw, write, etc. on the whiteboard, but the students can only watch the whiteboard and cannot perform any operations.

3. Download

Source code: OMCS.Demos.WhiteBoardTest.rar

When running the system for testing, please note:

(1) Start the OMCS server.

(2) Start the first client, select the "teacher" role, and log in to the default classroom.

(3) Start multiple clients, select the "student" role, and log in to the default classroom.

(4) Teachers can upload courseware, open courseware, delete courseware, turn pages of courseware, mark and write on courseware, and other operations.

The teacher interface is as follows:

[Recommended course: C# video tutorial]


The above is the detailed content of C# implements network electronic whiteboard and courseware functions (online teaching system). For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete