|
Hi Richard,
thanks for the answer. Yes, i have seen that article before, but this uses early binding with a com wrapper. Thats the easy way, but i am looking for late binding at runtime with no additionall assembly file, like this project uses.
best
K.
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
-----------------------
"This reply is provided as is, without warranty express or implied."
|
|
|
|
|
I have a MEF plugin that runs test for a medical instrument. The instrument starts the test service, and that service loads the MEF plugin and calls it's Execute method. This all runs in another thread.
The MEF plugin gets its settings from a Config file. Changes are made to the Config file using an editor designed for it. This editor is a stand alone EXE not connected to the instrument in any way.
The configuration can be set to run the tests for [n] times. This gives techs time to look at the instrument while its running.
1) Instrument starts the test process.
2) Test process loads the MEF plugin.
3) MEF plugin reads config file.
4) Tests inside the plugin execute using settings from config file.
5) At end of test, start next iteration until [n] is reached. Goto step 4.
What I'm wondering is this... Is it possible for an external EXE to somehow get data from the MEF plugin in real time? And, it also could commands be sent into the plugin, such as stop, pause, etc?
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
You could easily use self-hosted WCF to do this. Set it up to publish messages via named pipes and it'll run no problem.
This space for rent
|
|
|
|
|
Thanks, I'll look into that
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I don't like the bloat of WCF, but you can do secure named pipes pretty trivially without it.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Self hosted WCF doesn't add much at all. It's incredibly trivial.
This space for rent
|
|
|
|
|
I've never used PredicateBuilder before. If anyone has used it, I could use some help
List<PurchasingEntity> results = null;
IQueryable<PurchasingEntity> query = (from c in db.Companies
join p in db.Projects on c.Id equals p.CompanyId
join j in db.Jobs on p.Id equals j.ProjectId
select new PurchasingEntity
{
CompanyId = c.Id,
ProjectId = p.Id,
JobId = j.Id,
Phase = j.Phase,
Quantity = j.Quantity.HasValue ? j.Quantity.Value : 0,
StartDate = j.StartDate.HasValue ? j.StartDate : null
});
var predicate = PredicateBuilder.True<Purchasing>();
if (companyId > 0)
{
predicate = predicate.And(i => i.CompanyId == companyId);
}
if (projectId > 0)
{
predicate = predicate.And(i => i.ProjectId == projectId);
}
if (startDate != null)
{
predicate = predicate.And(i => i.StartDate >= startDate);
}
if (endDate != null)
{
predicate = predicate.And(i => i.StartDate <= endDate);
}
results = query.Where(predicate);
return results.ToList();
The compilation error is
cannot convert from 'System.Linq.Expressions.Expression<System.Func<Jayhawk.DAL.DataContext.Purchasing, bool>>' to 'System.Linq.Expressions.Expression<System.Func<Jayhawk.Entities.PurchasingEntity, int, bool>>'
Not quitre sure what's wrong here? Can anyone help?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
List<PurchasingEntity> results = null;
<pre>IQueryable<PurchasingEntity> query =
var predicate = PredicateBuilder.True<Purchasing>();
results = query.Where(predicate);
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I must have stared at that for an hour. Just didn't see it
var predicate = PredicateBuilder.True<PurchasingEntity>();
.
.
.
results = query.Where(predicate).ToList();
This works now
Thanks!
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Bugger that looked really useful but it is in c#7, VS 2017. We are stuck with 2015.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
public static class PredicateBuilder
{
public static Expression<Func<T, bool>> True<T>() { return f => true; }
public static Expression<Func<T, bool>> False<T>() { return f => false; }
public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> expr1,
Expression<Func<T, bool>> expr2)
{
var invokedExpr = Expression.Invoke(expr2, expr1.Parameters.Cast<Expression>());
return Expression.Lambda<Func<T, bool>>
(Expression.OrElse(expr1.Body, invokedExpr), expr1.Parameters);
}
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> expr1,
Expression<Func<T, bool>> expr2)
{
var invokedExpr = Expression.Invoke(expr2, expr1.Parameters.Cast<Expression>());
return Expression.Lambda<Func<T, bool>>
(Expression.AndAlso(expr1.Body, invokedExpr), expr1.Parameters);
}
}
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
It will cause an error because you are assigning IQueryable to List.
You can try this:
results = query.Where(predicate).ToList();
return results
I didn't used PredicateBuilder but i used System.Linq.Dynamic to create dynamic filtering or order by.
[Signature space for sale]
|
|
|
|
|
Hi All
I have an xml file.
<?xml version="1.0" encoding="utf-8"?>
<Achievements>
<Achievement number="208">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 150 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>7</Test>
</Achievement>
<Achievement number="209">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 200 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>8</Test>
</Achievement>
<Achievement number="210">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 250 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>9</Test>
</Achievement>
<Achievement number="211">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 300 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>10</Test>
</Achievement>
<Achievement number="6">
<Target>1</Target>
<CurrentStatus>1</CurrentStatus>
<AchievementText>Collect 1 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>200</Test>
</Achievement>
<Achievement number="7">
<Target>5</Target>
<CurrentStatus>5</CurrentStatus>
<AchievementText>Collect 5 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>300</Test>
</Achievement>
<Achievement number="8">
<Target>10</Target>
<CurrentStatus>10</CurrentStatus>
<AchievementText>Collect 10 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>400</Test>
</Achievement>
<Achievement number="9">
<Target>25</Target>
<CurrentStatus>25</CurrentStatus>
<AchievementText>Collect 25 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>500</Test>
</Achievement>
<Achievement number="10">
<Target>30</Target>
<CurrentStatus>30</CurrentStatus>
<AchievementText>Collect 50 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>600</Test>
</Achievement>
<Achievement number="11">
<Target>40</Target>
<CurrentStatus>40</CurrentStatus>
<AchievementText>Collect 100 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>700</Test>
</Achievement>
</Achievements>
In the Achievement number is randomly printed. So i have to avoid this. Whatever no may there. it should be reprinted by 1 to end no . that means
<?xml version="1.0" encoding="utf-8"?>
<Achievements>
<Achievement number="1">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 150 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>7</Test>
</Achievement>
<Achievement number="2">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 200 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>8</Test>
</Achievement>
<Achievement number="3">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 250 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>9</Test>
</Achievement>
<Achievement number="4">
<Target>100</Target>
<CurrentStatus>0</CurrentStatus>
<AchievementText>Collect 300 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>False</AchievementCollected>
<AchievementCompleted>False</AchievementCompleted>
<Test>10</Test>
</Achievement>
<Achievement number="5">
<Target>1</Target>
<CurrentStatus>1</CurrentStatus>
<AchievementText>Collect 1 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>200</Test>
</Achievement>
<Achievement number="6">
<Target>5</Target>
<CurrentStatus>5</CurrentStatus>
<AchievementText>Collect 5 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>300</Test>
</Achievement>
<Achievement number="7">
<Target>10</Target>
<CurrentStatus>10</CurrentStatus>
<AchievementText>Collect 10 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>400</Test>
</Achievement>
<Achievement number="8">
<Target>25</Target>
<CurrentStatus>25</CurrentStatus>
<AchievementText>Collect 25 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>500</Test>
</Achievement>
<Achievement number="9">
<Target>30</Target>
<CurrentStatus>30</CurrentStatus>
<AchievementText>Collect 50 Star </AchievementText>
<Header>Star Collector</Header>
<Reward>100</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>600</Test>
</Achievement>
<Achievement number="10">
<Target>40</Target>
<CurrentStatus>40</CurrentStatus>
<AchievementText>Collect 100 Stars</AchievementText>
<Header>Star Genius</Header>
<Reward>500</Reward>
<Experience>10</Experience>
<AchievementCollected>True</AchievementCollected>
<AchievementCompleted>True</AchievementCompleted>
<Test>700</Test>
</Achievement>
</Achievements>
How can i make the C# code for that.... How to check the achivement number
start to end...
start 1 to end = how much count ...
C#...
how can i do it..
code project is very weell
|
|
|
|
|
What code have you got so far? Have you read the XML in yet?
This space for rent
|
|
|
|
|
You deserialize it; and then sort the resulting "Achievent" list.
Convert object to xml in C#
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
in this case, my program gets an error and not functions. I want to create Diffie hellman implementations using an image but my image cannot read. anybody can help me.
|
|
|
|
|
Member 13838063 wrote: anybody can help me
No, I'm sorry - but we can't.
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
So tell us what the error message is, when it occurs, and show us the relevant code fragments that generate the problem. Then tell us what you have done to fix the problem and what effects that had. the better the information you give us, the better the solution we can give you.
Help us to help you!
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Might be wise to learn how to load an image first, before diving in too deep.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
When I run my C# windows form application that contains Crystal Report. It's asking me to enter the credential for the MySQL db every time. Even though I entered the correct user name and password. it is saying my user name or password is wrong. I have checked the credential many times and entered password is correct.
Code :
private void cmdPrintReport_Click(object sender, EventArgs e)
{
CrystalReport_Quotation1.SetDatabaseLogon("DB_USER_AFDR", "1237894560");
crvQuotation.ReportSource = CrystalReport_Quotation1;
crvQuotation.Refresh();
}
|
|
|
|
|
you able to login with these same credentials to your database directly?
modified 20-Sep-20 21:01pm.
|
|
|
|
|
Contact Crystal Reports on their forum[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hello,
I plan to make each tab pages at different sizes. Once I go to properties and change the size it doesn't allow to change. What's the way to do this?
modified 13-Feb-19 21:02pm.
|
|
|
|
|
Think about it: you can't have a set of tab pages that are all different sizes - because they all have to fit inside the same frame, and if the page size changed, so would the frame have to - which would make navigating kinda difficult and very ugly. You can have the frame allow for scroll bars (but even that should be pretty minimal if you can).
Given that tab pages are supposed to be showing related information, it's quite likely that you really need to rethink your UI design using different controls, or your users are going to hate it.
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
In WPF, tabs will "size to their content" unless you specifically override with sizing information.
The window can resize as well along with the visible tab.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Dear All,
We need code or library to use it in c# windows forms application to connect to a device connected to PC by USB.
The device Connected to PC "A" and I remotely Logged In to Server "B" and use a system in server "B",
I need to connect to the Device on the PC "A" from the server "B".
It is slimier to USB Network Gate but i need it to be in my c# code not a third party tool.
Please Help Me ASAP if you can
Thank You ALL
|
|
|
|