public static management instance() { if (_instance == null) { _instance = new management(); } return(_instance); }
/// <summary> /// device 추가 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, RoutedEventArgs e) { conn = new SQLiteConnection(@"Data Source=C:\Users\Endas\Desktop\test.db;Version=3;"); conn.Open(); String sql = "INSERT INTO Device VALUES ('" + device_ip.Text + "','" + device_id.Text + "','" + device_pw.Text + "','" + device_Mac.Text + "','" + device_subn.Text + "')"; SQLiteCommand command = new SQLiteCommand(sql, conn); int result = command.ExecuteNonQuery(); management MG = management.instance(); Device NewDevice = new Device(device_ip.Text, device_id.Text, device_pw.Text, device_Mac.Text, device_subn.Text); MG.AddToDevice(NewDevice); conn.Close(); }
public cctv() { InitializeComponent(); Camera_Connect(); management MG = management.instance(); DeviceCollection = MG.GetDeiviceList(); DeviceBox.Items.Add("전체보기"); for (int i = 0; DeviceCollection.Count() > i; i++) { DeviceBox.Items.Add(DeviceCollection[i].DEVICEIP); } DeviceBox.SelectedItem = "전체보기"; }
public MainWindow() { InitializeComponent(); //디비 연동해서 디바이스 카메라 초기에 리스트에 담아두기 MG = management.instance(); MG.AddToDevice(); MG.AddToCamera(); this.Loaded += new RoutedEventHandler(MainWindow_Loaded); this.MouseLeftButtonDown += Window1_MouseLeftButtonDown; // SQLiteConnection conn = null; // conn = new SQLiteConnection(@"Data Source=C:\Users\Endas\Desktop\test.db;Version=3;"); // conn.Open(); frame.Source = new Uri("dashboard.xaml", UriKind.Relative); this.Loaded += new RoutedEventHandler(MainWindow_Loaded); this.Closed += MainWindow_Closed; }
public home() { InitializeComponent(); mg = management.instance(); int CameraNum = mg.CountCamera(); int DeviceNum = mg.CountDevice(); // SaveOp.setValue(DeviceNum); // CCTV.setValue(CameraNum); Thread tt = new Thread(ThreadDeviceCheck); tt.Start(); Thread t = new Thread(ThreadDevice); t.Start(); Thread CCTV_TT = new Thread(ThreadCCTVCheck); CCTV_TT.Start(); Thread CCTV_T = new Thread(ThreadCCTV); CCTV_T.Start(); }
/// <summary> /// Camera와 연동 /// camera 정보를 가져와 Camera 클래스에 넣어주고 CameraCollection에 추가해준다. /// </summary> public void Camera_Connect() { management MG = management.instance(); AllCameraList = MG.GetCameraList(); listView.ItemsSource = AllCameraList; /* SQLiteConnection conn = null; * conn = new SQLiteConnection(@"Data Source=C:\Users\Endas\Desktop\test.db;Version=3;"); * conn.Open(); * * string sql = "select * from Camera"; * * SQLiteCommand cmd = new SQLiteCommand(sql, conn); * SQLiteDataReader rdr = cmd.ExecuteReader(); * while (rdr.Read()) * { * Camera camera=new Camera(rdr); * CameraCollection.Add(camera); * } * listView.ItemsSource = CameraCollection; * // rdr.Close(); * // conn.Close();*/ }