I edited my question. For the original question, you are correct. I can't. I found that out and also found the same stackoverflow link you have posted. So my revised question, is now: How can I make the button work on my progress unit and still have them floating?
Evilfish2000
Posts
-
[Solved/Workaround] Floating progress visualization with button control -
[Solved/Workaround] Floating progress visualization with button controlI have created a progress unit control that show a progress in my WPF application and it looks like this: [https://pasteboard.co/peNn9PiguyNC.png\](https://pasteboard.co/peNn9PiguyNC.png) The way I have done this is adding a `ListView` in my main application view that has a higher ZIndex than the other controls. This essentially overlays all controls, but does not react hit tests and is not visible.
I have most of the WPF code here, but if you need it, I can post it This works as you can see from the picture. If you look at the picture, there is a close image which is implemented this way:
I would like to be able to click this button to close any progress unit, in case it blocks the users view of any controls beneath it. With my current implementation this is not possible as my `ListView` currently is marked with `IsHitTestVisible="False"`. That means all controls under it also ignores the hit test, even if I set the buttons `IsHitTestVisible` to true. That means the button cannot be clicked by the mouse. How can I make the button work on my progress unit and still have them floating? So far: - I have experimented with overriding the hittest of the listview, so I can ignore hittest in code but allow the button to be pressed. This did not work, but I am still looking into this. - I have tried fiddling with the ZIndex on the Button, but if the listview ZIndex is lower that the rest, then buttons inside it will of cause also be behind it, no matter the buttons ZIndex. Its a part of the ListView. - I have also looked into the Adorner layer. I find that this could probably work, but it will require a complete rewrite of the logic and as I understand it is not really what it is meant for and will be very complicated. Any suggestions is very welcome. I am 99% done, I just need the last little piece of the puzzle. Solution/Workaround So browsing some more and looking a bit into the links in the replies, I came up with a solution. I found it while browsing but to be honest i forgot where from. Anyway, the first thin
-
Streaming data from one datalayer to anotherThat is a very interesting suggestion. I cant use that at the moment, because the system is not setup for that. But its clear this is the way to go. Thank you for that!
-
Streaming data from one datalayer to anotherI have a problem where I am creating a data layer for a project, where I have a scenario I don't really know which solution is better. The main function of the project/service is to regularly check for changes in several databases and copy the information to a data warehouse(one big database really). One scenario is when you add an new table to be tracked in the system. It has a specific task to copy the entire table from the site database to the warehouse. It does this by opening a data reader and then generate a batch INSERT script until it reaches a limit and then it execute the script towards the data warehouse. In pseudo code it looks like this:
using (IDbCommand clientCommand = Connection.CreateCommand())
{
clientCommand.CommandText = clientSql;
using (IDataReader clientReader = clientCommand.ExecuteReader()
{
while(clientReader.Read())
{
AddDataToList(clientReader);
}if(List.Count >= 100) { using (var com = warehouseConnection.CreateCommand()) { com.CommandText = GetInsertScript(List); AddedCount += com.ExecuteNonQuery(); } } }
}
Its more complicated than that, with more checks and sql code. I see two main issues with this: 1: Database logic in business logic that I want to move over to my data layer. This will make the code testable and easier to understand. 2: I do not like that we wait for data from the client, and then wait for data to be written to the other database, when this could be done in 2 tasks that transfer and receiving information asynchronously with each other via ConcurrentQueue for instance. This speeds up the process, which is also an issue in some cases. The problem I am having is that I that I cant get all the data in one go and then add it to the warehouse. Sometimes the tables are huge, which can lead to memory issues on the service. So I want to process the data as they come in through the client reader and continuously add them to the warehouse. But, I also want the database logic in the data layer. Adding the data is simple, but retrieving it is a bit more complicated. Researching this issue have given me 2 choices: Option 1 (Pull from data layer): I could use the yield keyword to return data as it comes through the reader in my data layer:
public IEnumerator GetTableContent()
{
SqlCommand command = new SqlCommand("command", SqlConnection);
using (var reader = command.ExecuteReader())
{
var items = new object[reader.FieldCount];
rea -
Code cast InvalidCastException when it "Shouldn't"Upon further research, it became clear that the versions of the POS system did not match the expected version. We transferred the source code over to the customer so he could build the files with his version and to great care in deleting all other versions of the affected DLL. We still get the same results. I also found the version on my machine that they actually got from me and ran a test on my machine, and it works without problems. So now to rule out a problem on the customer's end, he is currently sending me the entire software catalogue with my file changes to see if it crashes on my machine. If it fails, it's something in his project. If it does not fail... then I actually don't know. I will keep you posted.
-
Code cast InvalidCastException when it "Shouldn't"I thought I did confirm the versions, but it does look like there is a version mismatch with at least some files. I will update when I have more information.
-
Code cast InvalidCastException when it "Shouldn't"I am working with EFT solutions in the LSRetail LSOne POS, and one of my customers has an issue that I cannot figure out why happens. I have a class that has the following declaration:
public class MyEFTService : EFTBase, IEFTService, IMyInterface
{
//Code omitted
}The IMyInterface interface is one I have added so I can execute some added functionality to the class from another location. I do that like this:
public IPosTransaction RunTask()
{
var service = Services.EFTService(entry);
var dxcpcEft = (IMyInterface)service;//rest of code omitted
}
The Services.EFTService(entry) call returns the instance of MyEFTService created during startup, which I then cast to my IMyInterface and I can then do the calls I need to. This works on my machine, on my testers machine, and any co-workers machine. But it's here my customer has an issue. When we try to cast the instance to the IMyInterface interface on his machine we get an InvalidCastException. In debug, if I look at the service variable and browse through the object information, I can see variables that only my version of EFTBase has and I then know that it does have the IMyInterface as well. We also tried to execute service is IMyInterface in the immediate debug window of visual studio and it returns true. So, as far as I can see, the service variable DOES have the IMyInterface and visual studios Immediate debug window confirms it. We also tried to run service.GetType(), and that too returns information related to MyEFTService class:
{Name = "EFTService" FullName = "LSOne.Services.EFT.EFTService"}
Assembly: {LSOne.Services.EFT.MY_EFT, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null}
AssemblyQualifiedName: "LSOne.Services.EFT.MyEFTService, LSOne.Services.EFT.MY_EFT, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
Attributes: Public | BeforeFieldInit
BaseType: {Name = "EFTBase" FullName = "LSOne.Services.EFT.Common.EFTBase"}
ContainsGenericParameters: false
CustomAttributes: Count = 0
DeclaredConstructors: {System.Reflection.ConstructorInfo[1]}
DeclaredEvents: {System.Reflection.EventInfo[0]}
DeclaredFields: {System.Reflection.FieldInfo[15]}
DeclaredMembers: {System.Reflection.MemberInfo[75]}
DeclaredMethods: {System.Reflection.MethodInfo[52]}
DeclaredNestedTypes: {System.Reflection.TypeInfo.d__23}
DeclaredProperties: {System.Reflection.PropertyInfo[3]}
DeclaringM