diff --git a/Tech/Model/Repository/IMainRepository.cs b/Tech/Model/Repository/IMainRepository.cs
new file mode 100644
index 0000000..6018e10
--- /dev/null
+++ b/Tech/Model/Repository/IMainRepository.cs
@@ -0,0 +1,7 @@
+namespace Tech_Demo.Model.Repository
+{
+ public interface IMainRepository
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/Tech/MultiPlayerView.Designer.cs b/Tech/MultiPlayerView.Designer.cs
deleted file mode 100644
index a16e51f..0000000
--- a/Tech/MultiPlayerView.Designer.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System.ComponentModel;
-
-namespace Tech_Demo
-{
- partial class MultiPlayerView
- {
- ///
- /// Required designer variable.
- ///
- private IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
-
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.SuspendLayout();
- //
- // MultiPlayerView
- //
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
- this.Name = "MultiPlayerView";
- this.Size = new System.Drawing.Size(921, 550);
- this.ResumeLayout(false);
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Tech/MultiPlayerView.cs b/Tech/MultiPlayerView.cs
deleted file mode 100644
index f5d114c..0000000
--- a/Tech/MultiPlayerView.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Windows.Forms;
-
-namespace Tech_Demo
-{
- public partial class MultiPlayerView : UserControl
- {
- public MultiPlayerView()
- {
- InitializeComponent();
- }
- }
-}
\ No newline at end of file
diff --git a/Tech/PlumByteUI-Learn.csproj.DotSettings.user b/Tech/PlumByteUI-Learn.csproj.DotSettings.user
deleted file mode 100644
index 0c29a9f..0000000
--- a/Tech/PlumByteUI-Learn.csproj.DotSettings.user
+++ /dev/null
@@ -1,2 +0,0 @@
-
- ACFE594E-F51C-4B73-9661-0144FF9E33A3/f:Form1.resx
\ No newline at end of file
diff --git a/Tech/Presenter/MainPresenter.cs b/Tech/Presenter/MainPresenter.cs
new file mode 100644
index 0000000..a977359
--- /dev/null
+++ b/Tech/Presenter/MainPresenter.cs
@@ -0,0 +1,17 @@
+using Tech_Demo.Model.Repository;
+using Tech_Demo.View;
+
+namespace Tech_Demo.Presenter
+{
+ public class MainPresenter
+ {
+ private readonly IMainView _view;
+ private readonly IMainRepository _repository;
+
+ public MainPresenter(IMainView view, IMainRepository repository)
+ {
+ _view = view;
+ _repository = repository;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Tech/Presenter/PlayerPresenter.cs b/Tech/Presenter/PlayerPresenter.cs
new file mode 100644
index 0000000..4f57b91
--- /dev/null
+++ b/Tech/Presenter/PlayerPresenter.cs
@@ -0,0 +1,21 @@
+using Tech_Demo.Model;
+using Tech_Demo.View;
+
+namespace Tech_Demo.Presenter
+{
+ public class PlayerPresenter
+ {
+ private readonly IPlayerView _view;
+
+ public PlayerPresenter(IPlayerView view)
+ {
+ _view = view;
+ view.Presenter = this;
+ }
+
+ public Equipment GetEquipment()
+ {
+ return new Equipment {Id = 1, Name = "设备1", Ip = "192.168.1.110", Url = @"rtsp://10.211.55.2:8554/rains", Type = 1};
+ }
+ }
+}
\ No newline at end of file
diff --git a/Tech/Program.cs b/Tech/Program.cs
index 26acc46..1f82f71 100644
--- a/Tech/Program.cs
+++ b/Tech/Program.cs
@@ -1,28 +1,30 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Runtime.InteropServices;
-using System.Threading.Tasks;
using System.Windows.Forms;
+using Tech_Demo.Presenter;
+using Tech_Demo.View.Impl;
namespace Tech_Demo
{
static class Program
{
+ [DllImport("kernel32.dll")]
+ static extern bool AttachConsole(int dwProcessId);
+
+ private const int ATTACH_PARENT_PROCESS = -1;
+
///
/// The main entry point for the application.
///
[STAThread]
- [DllImport("kernel32.dll")]
- static extern bool AttachConsole(int dwProcessId);
- private const int ATTACH_PARENT_PROCESS = -1;
-
static void Main()
{
AttachConsole(ATTACH_PARENT_PROCESS);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1());
+ var mainView = new MainView();
+ mainView.Presenter = new MainPresenter(mainView, null);
+ Application.Run(mainView);
}
}
-}
+}
\ No newline at end of file
diff --git a/Tech/Tech.csproj b/Tech/Tech.csproj
index 6370625..2390d87 100644
--- a/Tech/Tech.csproj
+++ b/Tech/Tech.csproj
@@ -85,8 +85,11 @@
+
+
+
@@ -98,11 +101,12 @@
-
+
+
Form
-
- MainForm.cs
+
+ MainView.cs
UserControl
@@ -110,6 +114,7 @@
PlayerView.cs
+
ResXFileCodeGenerator
Resources.Designer.cs
@@ -123,8 +128,8 @@
UCOverview.cs
-
- MainForm.cs
+
+ MainView.cs
PlayerView.cs
diff --git a/Tech/View/IMainView.cs b/Tech/View/IMainView.cs
new file mode 100644
index 0000000..2ce21c0
--- /dev/null
+++ b/Tech/View/IMainView.cs
@@ -0,0 +1,9 @@
+using Tech_Demo.Presenter;
+
+namespace Tech_Demo.View
+{
+ public interface IMainView
+ {
+ MainPresenter Presenter { set; }
+ }
+}
\ No newline at end of file
diff --git a/Tech/View/IPlayerView.cs b/Tech/View/IPlayerView.cs
new file mode 100644
index 0000000..a5151f5
--- /dev/null
+++ b/Tech/View/IPlayerView.cs
@@ -0,0 +1,9 @@
+using Tech_Demo.Presenter;
+
+namespace Tech_Demo.View
+{
+ public interface IPlayerView
+ {
+ PlayerPresenter Presenter { set; }
+ }
+}
\ No newline at end of file
diff --git a/Tech/View/Impl/MainForm.Designer.cs b/Tech/View/Impl/MainView.Designer.cs
similarity index 99%
rename from Tech/View/Impl/MainForm.Designer.cs
rename to Tech/View/Impl/MainView.Designer.cs
index 5f6f266..d433402 100644
--- a/Tech/View/Impl/MainForm.Designer.cs
+++ b/Tech/View/Impl/MainView.Designer.cs
@@ -1,6 +1,6 @@
-namespace Tech_Demo
+namespace Tech_Demo.View.Impl
{
- partial class Form1
+ partial class MainView
{
///
/// Required designer variable.
@@ -28,7 +28,7 @@
///
private void InitializeComponent()
{
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainView));
this.panel1 = new System.Windows.Forms.Panel();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
diff --git a/Tech/View/Impl/MainForm.cs b/Tech/View/Impl/MainView.cs
similarity index 95%
rename from Tech/View/Impl/MainForm.cs
rename to Tech/View/Impl/MainView.cs
index 67f63e9..8a566de 100644
--- a/Tech/View/Impl/MainForm.cs
+++ b/Tech/View/Impl/MainView.cs
@@ -1,18 +1,15 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
using System.Drawing;
-using System.Linq;
using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
+using Tech_Demo.Presenter;
+using Tech_Demo.View;
-namespace Tech_Demo
+namespace Tech_Demo.View.Impl
{
- public partial class Form1 : Form
+ public partial class MainView : Form, IMainView
{
+ public MainPresenter Presenter { private get; set; }
[DllImport("user32")]
private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
@@ -27,14 +24,16 @@ namespace Tech_Demo
public const Int32 AW_SLIDE = 0x00040000; //使用滑动类型。缺省则为滚动动画类型。当使用AW_CENTER标志时,这个标志就被忽略。
public const Int32 AW_BLEND = 0x00080000; //使用淡出效果。只有当hWnd为顶层窗口的时候才可以使用此标志。
- public Form1()
+ public MainView()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
+ panelContainer.Controls.Clear();
var playerView = new PlayerView();
+ playerView.Presenter = new PlayerPresenter(playerView);
playerView.Dock = DockStyle.Fill;
panelContainer.Controls.Add(playerView);
// AnimateWindow(playerView.Handle, 1000, AW_HOR_POSITIVE | AW_SLIDE);
diff --git a/Tech/View/Impl/MainForm.resx b/Tech/View/Impl/MainView.resx
similarity index 100%
rename from Tech/View/Impl/MainForm.resx
rename to Tech/View/Impl/MainView.resx
diff --git a/Tech/View/Impl/PlayerView.cs b/Tech/View/Impl/PlayerView.cs
index 4d54b9c..530ebd2 100644
--- a/Tech/View/Impl/PlayerView.cs
+++ b/Tech/View/Impl/PlayerView.cs
@@ -4,12 +4,14 @@ using System.IO;
using System.Reflection;
using System.Windows.Forms;
using LibVLCSharp.Shared;
+using Tech_Demo.Presenter;
using Tech_Demo.Properties;
+using Tech_Demo.View;
using Vlc.DotNet.Forms;
namespace Tech_Demo
{
- public partial class PlayerView : UserControl
+ public partial class PlayerView : UserControl, IPlayerView
{
/**
* 单画面模式
@@ -43,6 +45,8 @@ namespace Tech_Demo
// }
}
+ public PlayerPresenter Presenter { private get; set; }
+
private void vlcControl_Click(object sender, EventArgs e)
{
}
@@ -153,7 +157,8 @@ namespace Tech_Demo
":network-caching=100", ":rtsp-tcp"
}; // { ":network-caching=100", ":rtsp -tcp", ":no-audio" }; // --avcodec-hw={any,d3d11va,dxva2,none}
// var videoUri = new Uri(@"rtsp://admin:abc123456@192.168.1.233:554/h264/ch33/main/av_stream");
- var videoUri = new Uri(@"rtsp://10.211.55.2:8554/rains");
+ var equipment = Presenter.GetEquipment();
+ var videoUri = new Uri(equipment.Url);
if (videoView.MediaPlayer == null)
{
var libVlc = new LibVLC(enableDebugLogs: true);