public void ClockStop(long ClockID)
        {
            ClsClock clock = (from x in this.ClockList where x.ID == ClockID select x).FirstOrDefault();

            clock.Status = false;
            Saveereignis(ClockID.ToString() + "_False");
            if (clock.DynDisplay)
            {
                ClsServer.Instance.SendMessage(ClsVarCom.ChangeDivVisibilityString(clock.Variable, "hidden"));
            }
        }
        public void SetTabellenVariableWert(string Variable, string Tabelle)
        {
            try
            {
                ClsTabellenVariabeln v = (from x in this.TabelleVariabelListe where x.ID == Variable select x).FirstOrDefault();
                if (v != null)
                {
                    v.Wert = Tabelle;

                    // send to HTML page
                    GlobalServerEvents.SendMessage("server", new ClsStringEventArgs(ClsVarCom.UpdateDivContentTab(Variable, v.Wert)));
                }
            }
            catch (Exception ex)
            {
                ClsError.Error(this.Name, MethodBase.GetCurrentMethod().ToString(), ex);
            }
        }
Exemple #3
0
        //private Display.ClsKommunikation ddk = new Display.ClsKommunikation();

        protected override void OnMessage(MessageEventArgs e)
        {
            try
            {
                var name = this.Context.QueryString["name"];

                if (e.IsBinary && this.loggedon)
                {
                    byte[] bytearr = e.RawData;
                    File.WriteAllBytes(this.binPfad, bytearr);

                    if (this.binTyp == "Bild")
                    {
                        // Bildliste senden
                        string ret = ClsRequests.DataRequest(new ClsCommand(command: "PictureList"));
                        this.SendAsync(ret, null);
                    }

                    if (this.binTyp == "Font")
                    {
                        // Fontliste senden
                        string ret = ClsRequests.DataRequest(new ClsCommand(command: "FontList"));
                        this.SendAsync(ret, null);
                    }

                    if (this.binTyp == "Audio")
                    {
                        // Audiofileliste senden
                        string ret = ClsRequests.DataRequest(new ClsCommand(command: "AudioFileList"));
                        this.SendAsync(ret, null);
                    }

                    return;
                }

                string x = !name.IsNullOrEmpty() ? String.Format("\"{0}\" to {1}", e.Data, name) : e.Data;

                GlobalServerEvents.Fire_GotMessage(this, new ClsStringEventArgs(x));

                ClsCommand rb = new JavaScriptSerializer().Deserialize <ClsCommand>(e.Data);

                if (rb.Command == "strPic")
                {
                    this.binTyp  = "Bild";
                    this.binPfad = Folder(rb.Value1, @"pictures\" + rb.Value2);
                    return;
                }

                if (rb.Command == "strFont")
                {
                    this.binTyp  = "Font";
                    this.binPfad = Folder(rb.Value1, "fonts");
                    return;
                }

                if (rb.Command == "strSnd")
                {
                    this.binTyp  = "Audio";
                    this.binPfad = Folder(rb.Value1, "sounds");
                    return;
                }

                if (rb.Domain == "AN")
                {
                    if (rb.Command == "allVarValues")
                    {
                        List <ClsTextVariabeln> tvl = ClsDBVariablen.Instance.GetAllTextVariablen();
                        for (int i = 0; i < tvl.Count; i++)
                        {
                            GlobalServerEvents.SendMessage("server", new ClsStringEventArgs(ClsVarCom.UpdateDivContentStr(tvl[i].ID, tvl[i].Wert)));
                        }
                    }
                }

                if (rb.Type == "req")
                {
                    string ret = ClsRequests.DataRequest(rb);
                    //int z = 0;
                    do
                    {
                        //z++;
                        //if (z > 10000)
                        //{
                        //    throw new Exception("Connection not open");
                        //}
                    } while (this.State != WebSocketState.Open);

                    this.SendAsync(ret, null);
                }
                else if (rb.Type == "logon")                 // Anmeldung
                {
                    //string user = Core.DBControler.ClsOptionsControler.Options3("UserName").Value;
                    string pwd = Core.DBControler.ClsOptionsControler.Password("Password");

                    if (pwd == rb.Value1)
                    {
                        this.loggedon = true;
                    }

                    ClsCommand cmd = new ClsCommand();
                    cmd.Domain = "loggedon";
                    cmd.Value1 = this.loggedon.ToString();
                    this.SendAsync(new JavaScriptSerializer().Serialize(cmd), null);
                    return;
                }
                else if (rb.Type == "loggedon")                 // Fragen ob angemeldet
                {
                    ClsCommand cmd = new ClsCommand();
                    cmd.Domain = "loggedon";
                    cmd.Value1 = this.loggedon.ToString();
                    this.SendAsync(new JavaScriptSerializer().Serialize(cmd), null);
                    return;
                }
                else
                {
                    if (!this.loggedon)
                    {
                        ClsCommand cmd = new ClsCommand();
                        cmd.Command = "nologgedon";
                        this.SendAsync(new JavaScriptSerializer().Serialize(cmd), null);
                        return;
                    }

                    ClsCommands.Command(rb);
                }
            }
            catch (Exception)
            {
            }
        }