answerstu

c# - How to point a delegate to an extension method

public class UITestCtrl{}public static class Ext{ public static void FindElement(this UITestCtrl clas) { }}public class Brwsr : UITestCtrl{ public void FindElement() { }}Now, I am trying to point delegate to extension methodprivate delegate void MyDell_();MyDell_ dell = new MyDell_(Ext.FindElement());I am getting error: Error CS7036 There is no argument given that corresponds to the required formal parameter 'clas' of 'Ext.FindElement(UITestCtrl)'Thanks...Read more

c# - UnityWebRequest sending blank data to HTTP

This is a sample of what I'm doing to send data to my host, however, I think it's sending blank data. For example in the "serverKeycode", I'm sending "example", but the server is receiving just "".C#WWWForm form = new WWWForm();form.AddField("serverKeycode", "example");form.AddField("username", authUsername.text);form.AddField("password", authPassword.text);UnityWebRequest www = UnityWebRequest.Post("http://example.com/authenticate.php", form);yield return www.SendWebRequest();PHPheader("Access-Control-Allow-Credentials: true");header('Access-C...Read more

c# - Error System.Nullable'1 automapper

i have entity class, pinjaman_DataEntities, that has 4 properties.public string appl_no { get; set; }public string reff_number { get; set; }public string cust_name { get; set; }public string merchant_id { get; set; }and i have a database context gt_applikasi_pinjaman that has more properties than pinjaman_DataEntities, but still have same name of 4 properties above. and i want to map from pinjaman_DataEntities to gt_appllikasi_pinjamanand this codes below :public bool updateFilter(pinjaman_DataEntities filterPinjaman){ bool valid = true;...Read more

c# - Win32 pen simulation not working with InjectTouchInput()

Im using win32 touchinjection on windows 10 desktop.I have been trying for two days to get pen simulation.The code below works with PointerInputType.Touch but i need pressure and orientation, which don't seem to work.GetLastError() returns 87 which means bad parameter but i have tried every pair of parameters i can think of. InitializeTouchInjection(); pointer = new PointerTouchInfo(); pointer.PointerInfo.PointerId = 1; pointer.PointerInfo.pointerType = PointerInputType.PEN; pointer.TouchMasks = Tou...Read more

c# - Why does DwmGetWindowAttribute with DWMWA_EXTENDED_FRAME_BOUNDS behave unexpectedly when switching monitors?

When my WinForm application is moved from a primary monitor to a secondary monitor, the bounds (Height and Width of the Window) value returned by these properties and winapi function does not change :Form.BoundsForm.SizeGetWindowRect()But the value returned by DwmGetWindowAttribute with DWMWA_EXTENDED_FRAME_BOUNDS changes drastically.Edits after suggestion from comments: For instance, in the primary monitor DwmgetWindowAttribute returns a rect of width and height 292, 100 and the other values return 306, 107. This is coherent considering the dr...Read more

c# - Compare list<object1> and list<object2>

colDiffUpdated and colDiffTarget have different values, How can I add to colTypes the difference of the two list? assume each list have different values. public List<columnTypes> colType = new List<columnTypes>(); public List<coldiffTypes> colDiffUpdated = new List<coldiffTypes>(); public List<coldiffTypesTarget> colDiffTarget = new List<coldiffTypesTarget>(); this is the class where i store the valuepublic class columnTypes { public string tblName { get; set; } publ...Read more

c# - Time Complexity - Which between these two algorithms is faster?

Description The goal of this program is to populate an orderList from the users orders and a productList foreach of those order. (Please ignore possible syntax errors from this pseudo-C#-code)Data Structuresclass User { List<Order> orders; }class Order { List<Product> products;}class Product { int price;}List<User> userList = GetUsersFromDB();List<Order> orderList = new List<Order>(); List<Product> productList = new List<Product>();First Versionforeach(User u in userList) { foreach(Or...Read more

C# Winforms Represent a Single Object as a Table

C# Winforms. I have a class. It has some public member variables. I want to display the values of the different members of the class in a table of two columns. First column is the member name, second is the value. Note: I don't have a collection of these, just one, So I don't want a DataGridView. Ideally, I would just like a control that I can bind my class to, then change the displayed text of first column to something readable for each member. Additionally, the member's values will change during program execution, and the table should upda...Read more

c# - Displaying list of name from an array into a class

How do I preload(form1_load) and display the list of name inside of an array or loaded to a list then display it?This is what I got:private void Form1_Load(object sender, EventArgs e) { Random rand = new Random(); int index = 0; string[] names = new string[] { "Josh", "Waylon", "Alan", "Jack", "John", "elaine", "Monica", "Kaithe", "Kim", "Jazy" };////preload the boxlist with 10 boxesfor (int i = 1; i <= 10...Read more

c# - Use everything before a specific character

So, I've been learning C# and I need to remove everything after the":" character.I've used a StreamReader to read the text file, but then I can't use the Split function, then I tried it by using an int function to import it, but then again I can't use the Split function? What I want this to do is import a text file that's written like;name:lastnamename2:lastname2And so that it only shows name and name2.I've been searching this for a couple of days but I can't seem to figure it out!I don't know what I'm doing wrong and how to import the text fil...Read more

c# - How to close XAML Frame Source content

I have a WPF window view with tabs, and in the tabs there are different WPF pages being shown. My code in each tab is similar to: . The Pressure.xaml.cs defines which viewmodel is used as the datacontext. When I close my window that has the tabs, my viewmodels for the pages on each keep tab keep running. Is there a way to stop the separate viewmodels from running?Main page XAML code:<TabItem> <TabItem.Header> <Label Content="Pressure" HorizontalAlignment="Center"/> </TabItem.Header> <Frame Source="P...Read more

c# - How to position "Selection Box" with ItemContainerStyle of a ListView?

I've been reading this documentation and I was wondering if it's possible to position the selection check box of the container? Specifically, this thing here:Ideally, I want it aligned on the right. So far I've tried to use <ListView.ItemContainerStyle> <Style TargetType="WHAT DO I WRITE HERE?"> <Setter Property="HorizontalAlignment" Value="Right"/> </Style></ListView.ItemContainerStyle>With various TargetTypes. Is it even possible to position that Selection-box?...Read more

c# - Accessing object created in different Window in WPF application

I have created one window and declared 2 instances of my object, then I modified them and wanted to pass to another Window. My questions are:How would i do that ?(I can pass simple types such as string or int trough window constructor but passing my own object giving me an error (Inconsistent Accessibility parameter order is less accessible then method))Does it have any connection with dataContext ?Can anybody explain to me how I can achieve that (in the simplest possible way)? What are the correct ways to do that ?Here is part of my code (ever...Read more