예제 #1
0
파일: Form1.cs 프로젝트: CarverLab/Oyster
        private void Form1_Load(object sender, EventArgs e)
        {
            string serverAddress = Settings.Default.ServerAddress,
                   serverPassword = Settings.Default.ServerPassword;

            if (string.IsNullOrEmpty(serverAddress))
            {
                serverAddress = "10.1.0.100";
                Settings.Default["ServerAddress"] = serverAddress;
                Settings.Default.Save();
            }
            if (string.IsNullOrEmpty(serverPassword))
            {
                serverPassword = Crypto.EncryptToBase64String("oyster1");
                Settings.Default["ServerPassword"] = serverPassword;
                Settings.Default.Save();
            }
            _oyster = new Oyster(serverAddress, Crypto.DecryptFromBase64String(serverPassword));
            foreach (StreamingEncoder encoder in _oyster.STREAMINGENCODERS)
            {
                if (encoder.CurrentStreamingEncoderType.ID == 1)
                {
                    Room room = _oyster.GetRoomById(encoder.RoomID);
                    if (room.ID != 7)
                    {
                        ListViewItem lvi = new ListViewItem(room.Description);
                        lvi.SubItems.Add(encoder.ControlAddress);
                        lvi.SubItems.Add("No");
                        lvi.SubItems.Add(string.Empty);
                        lvi.Tag = encoder;
                        listView1.Items.Add(lvi);
                    }
                }
            }
            //_updateThread.Start(); // TODO: possibly move this to a checkbox that disables the update button and starts continuous updates
        }
예제 #2
0
파일: Form1.cs 프로젝트: CarverLab/Oyster
        private void Form1_Load(object sender, System.EventArgs e)
        {
            string myPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            string myConfig = myPath + @"\myConfig.xml";

            Config cfg = new Config();
            Config.ConfigurationRow row;

            if (File.Exists(myConfig))
            {
                cfg.ReadXml(myConfig);
                row = cfg.Configuration[0];
            }
            else
            {
                frmServerInfo frm = new frmServerInfo();
            //				frm.ShowDialog(this);
            //				if (frm.ServerAddress.Length < 1)
            //				{
            //					Application.Exit();
            //				}
                string serverAddress = "10.1.0.100";
                string password;
                password = Convert.ToBase64String(Encrypt("oyster1"));
                row = cfg.Configuration.AddConfigurationRow(serverAddress,0,password);
                cfg.WriteXml(myConfig);
            }

            try
            {
                _oyster = new Oyster(row.ServerAddress,Decrypt(Convert.FromBase64String(row.Password)));
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Could not connect...");
                Application.Exit();
            }
            //_oyster.Login("sa","");
            foreach (StreamingEncoder encoder in _oyster.STREAMINGENCODERS)
            {
                if (encoder.CurrentStreamingEncoderType.ID == 1)
                {
                    Room room = _oyster.GetRoomById(encoder.RoomID);
                    if (room.ID != 7)
                    {
                        ListViewItem lvi = new ListViewItem(room.Description);
                        lvi.SubItems.Add(encoder.ControlAddress.ToString());
                        lvi.SubItems.Add("No");
                        lvi.SubItems.Add(string.Empty);
                        lvi.Tag = encoder;
                        listView1.Items.Add(lvi);
                    }
                }
            }
            _updateThread = new Thread(new ThreadStart(UpdateEncoderListThreadProc));
            //_updateThread.Start(); // TODO: possibly move this to a checkbox that disables the update button and starts continuous updates
        }
예제 #3
0
        private void imgButtonRename_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            Transitioning = true;
            LUser = (User)Session["LUser"];
            try
            {
                string[] checkit = imgButtonRename.ImageUrl.Split('/');

                switch(checkit[1])
                {
                    case "Tab_B_RenameRec.jpg":
                        TreeNode XNode = tv.GetNodeFromIndex(tv.SelectedNodeIndex);

                        if(XNode.Type == "Recording")
                        {
                            Functions F = new Functions();
                            string[] sarray = XNode.NodeData.Split(':');
                            int RecordingId = Convert.ToInt32(sarray[0],10);
                            Recording Rec = F.GetRecording(RecordingId);

                            int UserId = Convert.ToInt32(sarray[1],10);
                            User U = F.GetUser(UserId);

                            int SectionId = Convert.ToInt32(sarray[2],10);
                            Section S = F.GetSection(SectionId);

                            int CurrentSectionTypeId = S.CreatedBySectionType.ID;
                            LUser = (User)Session["LUser"];

                            if(LUser.ID == UserId)
                            {
                                Session["Recording"] = Rec;
                                Session["Section"] = S;
                                Session["User"] = U;
                                tbDialogData.Value = Rec.DisplayName;
                                //Response.Redirect("RenameRecording.aspx",false);
                                tbShowDialog.Value = "RenameRecording";
                                return;
                            }
                            else
                            {
                                txtAlert.Value = "Sorry: Only the owner of a recording may change the recording's name.";
                            }
                        }

                        break;

                    case "Tab_B_RenameSes.jpg":
                        TreeNode XNode2 = tv.GetNodeFromIndex(tv.SelectedNodeIndex);
                        if(XNode2.Type == "RecordingSession")
                        {
                            string[] SID = XNode2.NodeData.Split(':');
                            int UserId = Convert.ToInt32(SID[1],10);

                            if(LUser.ID == UserId)
                            {
                                Session["SessionInfo"] = XNode2;
                                //Response.Redirect("RenameSession.aspx",false);
                                tbDialogData.Value = XNode2.Text;
                                tbShowDialog.Value = "RenameSession";
                                return;
                            }
                            else
                            {
                                txtAlert.Value = "Sorry: Only the owner of a Session may change the Session's name.";
                            }
                        }
                        break;
                    case "Tab_B_RecordView.jpg":

                        break;
                    case "Tab_B_RecordSce.jpg":
                        TreeNode NScene = CTV.GetNodeFromIndex(CTV.SelectedNodeIndex);
                        OysterClassLibrary.Room RM = null;

                        OSystem = (Oyster)Session["Oyster"];
                        if(NScene.Type == "Scene")
                        {
                            int RoomId = Convert.ToInt32(NScene.NodeData,10);
                            RM = OSystem.GetRoomById(RoomId);
                        }
                        else
                        {
                            int SEId = Convert.ToInt32(NScene.NodeData,10);
                            OysterClassLibrary.StreamingEncoder SE = OSystem.GetStreamingEncoderById(SEId);
                            RM = SE.CurrentRoom;
                        }

                        tbDialogData.Value = LUser.CardNumber+ "*" + RM.AllCurrentCardReaders.Item(0).ID + "*" + RM.AllCurrentStreamingEncoders.Item(0).CurrentMediaBufferServer.Address + "*" + RM.AllCurrentStreamingEncoders.Item(0).CurrentMediaBufferServer.Port + "*" + RM.Description;
                        Session["RECORDSCENE"] = RM;

                        tbShowDialog.Value =  "RECORDSCENE";

                        break;

                    case "Tab_B_EditNote.jpg":
                        if(dgNotes.SelectedIndex == -1) return;
                        //txtPausePlayers.Value = "Pause";
                        LockAll.Value = "true";
                        DataRow r = DS.Tables[0].Rows[dgNotes.SelectedIndex];
                        //dgNotes.Visible = false;
                        //lblSync.Visible = true;
                        //tbSync.Visible = true;
                        //taNote.Visible = true;
                        //tbSync.Value = r[1].ToString();
                        //taNote.Value = r[2].ToString();

                        //TabStrip1.Enabled = false;
                        //imgButtonView.ImageUrl = "images/btnCancel.jpg";
                        //imgButtonRename.ImageUrl = "images/btnConfirm.jpg";
                        //imgButtonView.Visible=true;
                        //imgButtonRename.Visible=true;
                        //imgButtonMove.Visible=false;
                        //imgButtonMisc.Visible=false;
                        //Session["NoteAction"] = "Update";

                        tbDialogData.Value = r[1].ToString() +"*"+ r[2].ToString();

                        tbShowDialog.Value =  "EditNote";
                        //imgButtonMisc.ImageUrl = "images/Tab_B_UpdateNote.jpg";
                        //imgButtonMisc.Visible = true;
                        //                    Session["DS"] = DS;
                        //                    Session["DA"] = DA;
                        //                    Session["SC"] = SC;
                        break;
                    case "Tab_B_UpdateNote.jpg":
                        //DS.Tables[0].Rows[dgNotes.SelectedIndex].AcceptChanges;
                        DS = (DataSet)Session["DS"];
                        DA = (SqlDataAdapter)Session["DA"];
                        SC = (SqlConnection)Session["SC"];
                        DA.Update(DS);
                        imgButtonMisc.Visible = true;
                        Session["DS"] = DS;
                        Session["DA"] = DA;
                        Session["SC"] = SC;
                        LockAll.Value = "false";

                        break;
                    case "btnConfirm.jpg":
                        string sAction = (string)Session["NoteAction"];
                        LockAll.Value = "false";

                        if(sAction == "New")
                        {
                            string[] NodeData = txtNotes.Value.Split(' ');
                            // Functions F = new Functions();
                            string sNoteValue = taNote.Value;
                            //F.AddNote(Convert.ToInt32(NodeData[0],10),NodeData[2],sNoteValue);
                            string sTimeStamp = txtTimeStamp.Value;
                            DS = (DataSet)Session["DS"];
                            DA = (SqlDataAdapter)Session["DA"];
                            SC = (SqlConnection)Session["SC"];
                            DataRow NewRow = DS.Tables[0].NewRow();
                            NewRow[1] = sTimeStamp;
                            NewRow[2] = sNoteValue;
                            NewRow[3] = Convert.ToInt32(NodeData[0],10);
                            DS.Tables[0].Rows.Add(NewRow);
                            try
                            {
                                DA.Update(DS);
                            }
                            catch(Exception Err)
                            {
                                txtAlert.Value = Err.Message;
                            }
                            SwitchButtons(3);
                            //RefreshGrid();
                            Session["NoteAction"] = "Nutn";
                            TabStrip1.Enabled = true;
                        }
                        else if(sAction == "Update")
                        {

                            DS = (DataSet)Session["DS"];
                            DA = (SqlDataAdapter)Session["DA"];
                            SC = (SqlConnection)Session["SC"];

                            DataRow r2 = DS.Tables[0].Rows[dgNotes.SelectedIndex];
                            r2[2] = taNote.Value;
                            //DS.Tables[0].AcceptChanges();
                            DA.Update(DS);
                            SwitchButtons(3);
                            //RefreshGrid();
                            Session["NoteAction"] = "Nutn";
                            TabStrip1.Enabled = true;
                        }
                        else if(sAction == "Delete")
                        {
                            DS = (DataSet)Session["DS"];
                            DA = (SqlDataAdapter)Session["DA"];
                            SC = (SqlConnection)Session["SC"];
                            DataRow r3 = DS.Tables[0].Rows[dgNotes.SelectedIndex];
                            r3.Delete();
                            //DS.Tables[0].AcceptChanges();
                            DA.Update(DS);
                            SwitchButtons(3);
                            //RefreshGrid();
                            Session["NoteAction"] = "Nutn";
                            TabStrip1.Enabled = true;
                        }
                        break;
                }
            }
            catch(Exception Err)
            {
                txtAlert.Value = Err.Message;
            }
        }