If you're subscribing to the event when you create the control, you just need a local variable of the correct type:
var view = new ConnectionView();
view.ConnectedToDevice += YourEventHandler;
CurrentView = view;
If you want to subscribe at some other point, the as operator would work:
var connectionView = CurrentView as IConnectionView;
if (connectionView != null)
connectionView.ConnectedToDevice += YourEventHandler;
NB: There's a subtle race-condition in your RaisePropertyChanged method. It's possible that the last subscriber could be removed between the not-null check and the invocation. The simplest fix is to copy the delegate to a local variable at the start:
protectedvoid RaisePropertyChanged(string propertyName)
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
I have a C# ASP Web project where I’m required to produce a 200+ page PDF to eventually download and open on the browser. I have no experience in building a PDF file, and I was wondering if someone could point me in the right direction. I need a component / product / method that would be able to handle such a large report.
I have searched for demo project for Stack Exchange Redis in .NetFramework 4.0 C# but I didn't find yet.
Please share if possible.
Need: I want to use this in caching for storing just key, value pair. I have used system.caching but it destroy cache after service restart.
So I have used first Service Stack Redis but it have limitation of 6000 request per day and my project have almost 282984 requests per day.
So I switched to Stack Exchange Redis. I have made sample project and it works fine in my local machine. But when I deploy project on staging environment gives below error:
It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. UnableToResolvePhysicalConnection on PING
StackExchange.Redis.RedisConnectionException: It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. UnableToResolvePhysicalConnection on PING
at StackExchange.Redis.ConnectionMultiplexer.ConnectImpl(Func`1 multiplexerFactory, TextWriter log)
at StackExchange.Redis.ConnectionMultiplexer.Connect(String configuration, TextWriter log)
at StackExchangeApplication.RedisHelper.GetStringValue(GetValueRequestMessage requestMessage)
Here is my code:
publicstatic ConnectionMultiplexer _connection;
publicstatic IDatabase _redisDatabase;
_connection = ConnectionMultiplexer.Connect("localhost");
_redisDatabase = _connection.GetDatabase();
publicvoid AddStringKeyValue(string key, string value, int expireInMinute)
bool result = _redisDatabase.StringSet(key, value, TimeSpan.FromMinutes(expireInMinute), When.Always,
thrownew Exception("Failed To add key value in Redis server Key : " + key + ", Value : " + value);
publicstring GetStringValue(string key)
string value = _redisDatabase.StringGet(key);
Please help if anyone tried this I am finding out solution from last 3 days .
Just a wild guess (I have no idea what redis is) you are setting your ConnectionMultiplexer to localhost and deploying to a server which does not have localhost. You need to give the staging server the correct address to your redis server
Never underestimate the power of human stupidity
Error 3 says that textbox1 isn't visible in that class.
Error 2 - well, the error will give you a line number. What's at that line? Double click on the error in the error window and Visual Studio will take you to that line (note, this is the error window, not the output window).
Last Visit: 31-Dec-99 18:00 Last Update: 30-Aug-15 14:16