public void MainFunc() { // Создаём каналы IpcChannel channel1 = new IpcChannel(); IpcChannel channel2 = new IpcChannel(); IpcChannel channel3 = new IpcChannel(); IpcChannel channel4 = new IpcChannel(); IpcChannel channel5 = new IpcChannel(); // Регистрируем канал. System.Runtime.Remoting.Channels.ChannelServices. RegisterChannel(channel1, false); // Регистрируем клиентские удалённые обьекты. System.Runtime.Remoting.WellKnownClientTypeEntry remoteType1 = new System.Runtime.Remoting.WellKnownClientTypeEntry( typeof(ClassLibrary1.Class1), "ipc://localhost:9090/RemoteObject1.rem"); System.Runtime.Remoting.WellKnownClientTypeEntry remoteType2 = new System.Runtime.Remoting.WellKnownClientTypeEntry( typeof(ClassLibrary2.Class2), "ipc://localhost:9090/RemoteObject2.rem"); System.Runtime.Remoting.WellKnownClientTypeEntry remoteType3 = new System.Runtime.Remoting.WellKnownClientTypeEntry( typeof(ClassLibrary3.Class3), "ipc://localhost:9090/RemoteObject3.rem"); System.Runtime.Remoting.WellKnownClientTypeEntry remoteType4 = new System.Runtime.Remoting.WellKnownClientTypeEntry( typeof(ClassLibrary4.Class4), "ipc://localhost:9090/RemoteObject4.rem"); System.Runtime.Remoting.WellKnownClientTypeEntry remoteType5 = new System.Runtime.Remoting.WellKnownClientTypeEntry( typeof(ClassLibrary5.Class5), "ipc://localhost:9090/RemoteObject5.rem"); System.Runtime.Remoting.RemotingConfiguration. RegisterWellKnownClientType(remoteType1); System.Runtime.Remoting.RemotingConfiguration. RegisterWellKnownClientType(remoteType2); System.Runtime.Remoting.RemotingConfiguration. RegisterWellKnownClientType(remoteType3); System.Runtime.Remoting.RemotingConfiguration. RegisterWellKnownClientType(remoteType4); System.Runtime.Remoting.RemotingConfiguration. RegisterWellKnownClientType(remoteType5); // Создаём приемники сообщений string objectUri; System.Runtime.Remoting.Messaging.IMessageSink messageSink1 = channel1.CreateMessageSink( "ipc://localhost:9090/RemoteObject1.rem", null, out objectUri); System.Runtime.Remoting.Messaging.IMessageSink messageSink2 = channel2.CreateMessageSink( "ipc://localhost:9090/RemoteObject2.rem", null, out objectUri); System.Runtime.Remoting.Messaging.IMessageSink messageSink3 = channel3.CreateMessageSink( "ipc://localhost:9090/RemoteObject3.rem", null, out objectUri); System.Runtime.Remoting.Messaging.IMessageSink messageSink4 = channel4.CreateMessageSink( "ipc://localhost:9090/RemoteObject4.rem", null, out objectUri); System.Runtime.Remoting.Messaging.IMessageSink messageSink5 = channel5.CreateMessageSink( "ipc://localhost:9090/RemoteObject5.rem", null, out objectUri); // Создание экземпляра удаленного объекта service1 = new ClassLibrary1.Class1(); service2 = new ClassLibrary2.Class2(); service3 = new ClassLibrary3.Class3(); service4 = new ClassLibrary4.Class4(); service5 = new ClassLibrary5.Class5(); return; }
private void Button_Click(object sender, RoutedEventArgs e) { ClassLibrary1.Class1 obj = new ClassLibrary1.Class1(); }
static void Main(string[] args) { Console.WriteLine("Give two inputs : Operations performed are in the way -> A op B"); dynamic number1 = Console.ReadLine(); dynamic number2 = Console.ReadLine(); dynamic ans = 0; ClassLibrary1.Class1 newObject = new ClassLibrary1.Class1(); System.Type type1 = number1.GetType(); System.Type type2 = number2.GetType(); if (type1.Name == "Int32" && type2.Name == "Int32") { ans = newObject.Addition <int>(number1, number2); Console.WriteLine("The addition output is:{0}", ans); ans = ans = newObject.Subtraction <int>(number1, number2); Console.WriteLine("The subtraction output is:{0}", ans); ans = newObject.Multiplication <int>(number1, number2); Console.WriteLine("The multiplication output is:{0}", ans); ans = newObject.Divison <int>(number1, number2); if (ans == 0) { Console.WriteLine("Divide by Zero Error"); } else { Console.WriteLine("The divison output is:{0}", ans); } } else { number1 = Convert.ToDouble(number1); number2 = Convert.ToDouble(number2); ans = newObject.Addition <double>(number1, number2); Console.WriteLine("The addition output is:{0}", ans); ans = newObject.Subtraction <double>(number1, number2); Console.WriteLine("The subtraction output is:{0}", ans); ans = newObject.Multiplication <double>(number1, number2); Console.WriteLine("The multiplication output is:{0}", ans); ans = newObject.Divison <double>(number1, number2); if (ans == 0) { Console.WriteLine("Divide by Zero Error"); } else { Console.WriteLine("The divison output is:{0}", ans); } } Console.WriteLine("Enter the numbers"); List <double> list = new List <double>(); int Val; do { double num = Convert.ToDouble(Console.ReadLine()); list.Add(num); Console.WriteLine("Still want to continue...Press 1"); Val = Convert.ToInt32(Console.ReadLine()); } while (Val == 1); Console.WriteLine("The sum is:{0}", newObject.Addition <double>(list)); Console.ReadKey(); }
public void TestMethod1() { ClassLibrary1.Class1 klass = new ClassLibrary1.Class1(); string helloWorld = klass.GetHelloWorld("richard"); Assert.AreEqual(String.Format("Hello {0}", "richard"), helloWorld); }
public void DoSomething() { var class1 = new ClassLibrary1.Class1(); }
public void TestMethod1() { ClassLibrary1.Class1 tmp = new ClassLibrary1.Class1(); Assert.IsTrue(1 == 1); }
public void TestMethod1() { var cl = new ClassLibrary1.Class1(); Assert.AreEqual(cl.Method1(2, 2), 4); }
private void okButton_Click(object sender, EventArgs e) { ClassLibrary1.Class1 obj = new ClassLibrary1.Class1(); MessageBox.Show(obj.sayhello()); }
public void teste1() { ClassLibrary1.Class1 x = new ClassLibrary1.Class1(); x.teste(); }
public MainWindow() { ClassLibrary1.Class1 tmp = new ClassLibrary1.Class1(); InitializeComponent(); }
public Class1() { ClassLibrary1.Class1 cls = new ClassLibrary1.Class1(); cls.Display(); }
public void TestMethod1() { var c1 = new ClassLibrary1.Class1(); }
static void Main(string[] args) { ClassLibrary2.Class1 c = new ClassLibrary1.Class1().GetFromClassLibrary2(); }
private void Button1_Click(object sender, EventArgs e) { IntPtr tmp = Marshal.AllocCoTaskMem(W * H * 3); ClassLibrary1.Class1 CL = new ClassLibrary1.Class1(); Rectangle rect = new Rectangle(0, 0, W, H); for (int i = 0; i < 10; i++) { Bitmap bm = (Bitmap)CTLS[i].Image; BitmapData b = bm.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); CL.MoveMemory(b.Scan0, ref tmp, (uint)(W * H * 3)); Mems[i] = Marshal.AllocCoTaskMem(W * H * 3); CL.MoveMemory(tmp, ref Mems[i], (uint)(W * H * 3)); bm.UnlockBits(b); } Marshal.FreeCoTaskMem(tmp); var P = Task.Run(() => { Random w = new Random(); for (int i = 0; i < 10; i++) { bcTasks.Add(Mems[i]); Console.WriteLine($"{i + 1}番目タスク登録"); Console.WriteLine($"{(int)(5 * w.NextDouble())}"); if ((int)(10 * w.NextDouble()) > 2) { Console.WriteLine("Wait..."); System.Threading.Thread.Sleep(5); } } }); var C = Task.Run(() => { using (Graphics G = Graphics.FromImage(pictureBox12.Image)) { using (Graphics G2 = Graphics.FromImage(pictureBox3.Image)) { for (int i = 0; i < 10; i++) { IntPtr data = bcTasks.Take(); Bitmap tmpBM = new Bitmap(W, H, PixelFormat.Format24bppRgb); BitmapData tmpBD = tmpBM.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); IntPtr t = tmpBD.Scan0; CL.MoveMemory(data, ref t, (uint)(W * H * 3)); tmpBM.UnlockBits(tmpBD); G.DrawImage(tmpBM, W * (i % 5), H * (i / 5), W, H); tmpBD = tmpBM.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); t = tmpBD.Scan0; CL.MoveMemory(data, ref t, (uint)(W * H * 3)); tmpBM.UnlockBits(tmpBD); G2.DrawImage(tmpBM, W * (i % 3), H * (i / 3), W, H); Console.WriteLine($"{i + 1}番目タスク処理"); } } } Invoke((MethodInvoker) delegate { pictureBox12.Refresh(); pictureBox3.Refresh(); }); }); //Marshal.FreeCoTaskMem(tmp); }
public void TestMethod2() { ClassLibrary1.Class1 c = new ClassLibrary1.Class1(); Assert.AreEqual(300, c.Sum(2, 1)); }
static void Main(string[] args) { ClassLibrary1.Class1 class1 = new ClassLibrary1.Class1(); class1.Name = "Ivan"; class1.balans = 100; Console.WriteLine($"Name:{class1.Name} balans:{class1.balans}"); }
public IActionResult Login(string returnUrl = null) { var foo = new ClassLibrary1.Class1(); ViewData["ReturnUrl"] = returnUrl; return View(); }
public MainWindow() { InitializeComponent(); ClassLibrary1.Class1 c1 = new ClassLibrary1.Class1(); }
public Form1() { InitializeComponent(); var a = new ClassLibrary1.Class1(); var b = new Precompiled1.Class1(); }
public void TestMethod1() { ClassLibrary1.Class1 klass = new ClassLibrary1.Class1(); string helloWorld = klass.GetHelloWorld(); Assert.AreEqual("Hello world", helloWorld); }
public Form1() { InitializeComponent(); clsTest = new ClassLibrary1.Class1(); }
public LexImportFields() { m_TESTINGCLASS = new ClassLibrary1.Class1(); m_classFields = new Hashtable(); m_allFields = new Hashtable(); m_dupFields = new Hashtable(); m_uniqueFields = new Hashtable(); m_classPartOf = new Hashtable(); m_autoFields = new Hashtable(); m_AbbrSignatures = new ArrayList(); }
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { ClassLibrary1.Class1 obj = new ClassLibrary1.Class1(); MessageBox.Show(obj.sayhello()); }
public static void Main(string[] args) { var q = new ClassLibrary1.Class1(); }
public static void Main(string[] args) { var test1 = new ClassLibrary1.Class1(); var test2 = new ClassLibrary2.Class1(); }