|
OK, so scrap your code and rewrite it in C++. Oh, there's a runtime for that too. Well, depending on which version of C++ you use, you might find that the runtime for that is already installed, saving you the trouble. But, that's only IF it's already installed.
|
|
|
|
|
Hi, I have a small app that exposes a volatile singleton class in a class library. It is consumed by 2 applications that depend on it. Here is my intent: when I add an item to the collection in 1 program, I need the other program to see it. The other methods in this class that aren't included here are Save and Delete operations to the database that are called when I add or remove an item from the collection. My problem is that eventhough I stated the keyword volatile, the added item in the collection isn't shown in the collection in the other application.
Each viewmodel has a reference to the list it is contained in. When I want to save it, I add it to my list and the list saves it to my database.
So the way my app works:
- start app 1 that shows a list of viewmodels exposed by a "thread-safe" singleton class.
- start app 2 that adds a viewmodel to the list exposed by that same singleton class.
- list in app 1 is autmatically updated as it should be the same reference.
That last part apparantly isn't true when I test my code. Can you help me out ?
public class CursistDepository : ObservableCollection<CursistViewModel>, IPersonDepository<CursistViewModel>
{
private static volatile CursistDepository instance;
private static readonly object padlock = new object();
public static CursistDepository Instance
{
get
{
if (instance == null)
{
lock(padlock)
{
if(instance==null)
{
instance = new CursistDepository();
IEnumerable<ICursist> persons = Cursist.Select();
foreach (ICursist person in persons)
{
CursistViewModel model = new CursistViewModel(person);
instance.Add(model);
}
}
}
}
return instance;
}
}}
|
|
|
|
|
Each process gets it's own instance of the static variable; it's not shared across the AppDomain.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
After your post, I went to search on how to do it cross apdomain and came up with marshalbyrefobject. However the documentation I came across was limited. Here is what I tried: I made a wrapper class that inherits from marshalbyrefobject and has variables linking to my depository classes. That didn't really do the trick sadly. Does anyone have a reliable way to do this?
|
|
|
|
|
Nico Haegens wrote: That didn't really do the trick sadly Should work if both apps access the same AppDomain.
Nico Haegens wrote: Does anyone have a reliable way to do this? Do what exactly? Share data?
Try SQLite's in memory-database if the apps are on the same server. It's a lot friendlier then memory-mapped files.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Instead of a direct communication of your applications with the database, make them communicate with a serve which in turn communicates with the database. Now the server can raise an event when data of the database were changed. Your applications can subscribe to the events of the server, and update their local data.
|
|
|
|
|
That's pretty much what I was doing by seperating the database classes through viewmodels. Can you provide an example of your implementation?
|
|
|
|
|
The point is: you need an extra application as a server (a Windows Service is likely a good way to do that). For communication between server and client, you can use e.g. .Net Remoting; keep in mind that you'll need to communicate events from the server to the client - not all types of communication allow for that.
|
|
|
|
|
Two applications (two processes) run in completely separate spaces, static state (including singleton classes) aren't shared between processes. You need some cross-process communication to have two processes synchronise with the same data source.
What you need is a setup with not two applications but three: two client applications which talk to a service which contains all the database access, and fires events or sends messages when it's updated. Alternatively, you need to ask the database directly for updates (which may require polling, not sure if it's possible with triggers).
|
|
|
|
|
Hi, Iam using VS2010, while generating RDLC report, Iam using IIf statement for calculations.
But I found a typical problem which is very different.
Because from the Code.Functions for calculation, simply it's working fine, when I give the
below command directly
=Code.AddMyNet(Sum(ReportItems!itm_value.Value))
But I wish to give like the below command, It's giving error "local report processing"
=IIf((ReportItems!Textbox15.Value ="CARRY FORWARDED "), Code.AddMyNet(Sum(ReportItems!itm_value.Value)), Nothing)
Actually Function AddMyNet() used to calculate the pagewise running value total.
And hence any guidances will be helpful
Thanks & Regards
Paramu
|
|
|
|
|
Hi, please refrain on posting same question on different forums. Other members won't feel happy about this. Thanks.
Don't mind those people who say you're not HOT. At least you know you're COOL.
I'm not afraid of falling, I'm afraid of the sudden stop at the end of the fall! - Richard Andrew x64
|
|
|
|
|
Ok. Karen...I will followup
|
|
|
|
|
how do i send notifications using web services from server to client side in c#?i am making a student portal system as my final year project.
|
|
|
|
|
Services that run over HTTP don't allow for 'server push' as HTTP is a stateless, connectionless protocol (at least in principle). You'll need to poll for updates from the client.
|
|
|
|
|
You wouldn't use a web service to do this. What you want to be looking at is pushing out the data using something like a WebSocket or a FlashSocket. If I were you, I would take a look at SignalR[^] (if you were doing this with Node.JS, I would recommend using Socket.IO[^] instead).
|
|
|
|
|
Hi All,
I am looking for expert advice on printing the pdf files at client machine.
I have created a sample project named ClientPrint as
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Printing;
using System.Runtime.InteropServices;
namespace ActiveX
{
public interface IActiveXPrintLib
{
void PrintFile(string filePath);
}
[ProgId("ActiveX.PrintFile")]
[ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]
public class ActiveXPrintLib : IActiveXPrintLib
{
[ComVisible(true)]
public void PrintFile(string filePath)
{
AcroPDFLib.AcroPDF AcroPdf = new AcroPDFLib.AcroPDF();
AcroPdf.LoadFile(filePath);
AcroPdf.printAll();
}
}
}
I have created the dll and register the dll using regasm command on client machine.
Now at time of consuming the print method at client side using javascript as
<object id="myControl1" name="myControl1" classid="clsid:ActiveX.ActiveXPrintLib"> </object>
var axComponent = new ActiveXObject("ActiveX.ActiveXPrintLib");
alert(axComponent);
if (axComponent == null) {
alert('Probably not installed');
}
else {
axComponent.PrintFile('<%= Page.ResolveUrl("~/PdfTemp/0d818b57-9384-4f52-ae89-8ef5868064b7.pdf") %>');
alert('yes');
}
I am getting the error that automation server can't create object, using IE I have enabled the active x and permisssions to download the activex. but it still gives me same error.
I am not sure whether my code is correct or not.
Any advice is really helpful.
Thanks in advance.
Sachin Mehndiratta
mehndi.sachin@gmail.com
modified 30-May-14 4:55am.
|
|
|
|
|
I've looked and I can't see the C# in there. You might want to try the VB.NET forum, where the VB.NET experts hang out.
|
|
|
|
|
yeah, my mistake, I have already posted to .net framework
|
|
|
|
|
Which is not VB.NET, please delete it from there and try the Visual Basic forum.
|
|
|
|
|
Appology for the mistake, code is now converted to C#
|
|
|
|
|
|
Don't crosspost.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Normally, I'd agree with you. But in this case, both Pete and RMC told the user to post the question to a different forum, and they obviously didn't notice the "delete" button on the old messages.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
When a file is sent to print in printer++ (a open source virtual printer, developed in c#.net), I want to get the full file name with its full physical path of that file in my c# winform app. Means I want to create a copy of these file(s) that are printed by printer++.
Actually I don't need print, i need copy that image to another location using my winform app. The scenario is when a user print any image with printer++ then my app (it will be installed with printer++ on users pc) automatically get that image and keep a copy in a folder.
These Files should be images like *.png, *.gif, *.jpg etc.
how I do this. Any suggestions for doing this in C#.Net.
|
|
|
|
|
Look at the source code for printer++, and see how it saves and manages the path as it is printing.
|
|
|
|