|
Ok, that did it. Thanks
Any way to determine if my app opened that instance of Windows Photo Viewer?
If it's not broken, fix it until it is
|
|
|
|
|
Only if you keep a list of the process instances you open - AFAIK windows doesn't keep a record of who opened processes.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Surely it would be simpler to hang on to the Process instance you've created? Then you can check its HasExited property, and call CloseMainWindow / Kill as necessary.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
I have a server having an ODBC connection for Pervasive database.
I would like from my laptop to connect to that ODBC?
Is it possible? How can I do this using C#?
Thanks,
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
|
Create a web service on the server and communicate with that to get database access.
|
|
|
|
|
I am developing a software to read some data from a text and plot the data in the c# chart using windows forms。However,I can't zoom the chart in Yaxis if i don't select a region and zoom it first.Who can tell me how to zoom a chart using up key automatically without zoom a region first?
|
|
|
|
|
That sounds suspiciously like functionality specific to whatever charting library you're using.
Without knowing that, it's pretty much impossible to tell you anything useful.
|
|
|
|
|
Can you select a region by code? If so, select some region in the middle of the currently visible part of the chart first, the apply the zoom.
|
|
|
|
|
hi
Quote: What are feature extraction methods in image quality assessment?
|
|
|
|
|
Combined with your other question below, this is sounding a lot like your homework.
And we do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Try it yourself, you may find it is not as difficult as you think!
If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
hi
Quote: How can i extract image structural information based on SSIM index (IQA)?
|
|
|
|
|
By reading the documentation and writing some code.
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace listeimagetest2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
DirectoryInfo dir = new DirectoryInfo(@"C:\Users\Pictures\Images");
foreach (FileInfo file in dir.GetFiles())
{
try
{
this.imageList1.Images.Add(Image.FromFile(file.FullName));
this.imageList1.ImageStream.Add(Image.FromFile(file.FullName));
}
catch
{
Console.WriteLine("Ce n'est pas un fichier image");
}
}
this.listView1.View = View.LargeIcon;
this.imageList1.ImageSize = new Size(103, 147);
this.listView1.LargeImageList = this.imageList1;
for (int j = 0; j < this.imageList1.Images.Count; j++)
{
ListViewItem item = new ListViewItem();
item.ImageIndex = j;
this.listView1.Items.Add(item);
}
}
}
}
|
|
|
|
|
|
Here's how I do it:
private ImageList images = new ImageList();
private void ShowImages(ListView lv, string path, string filter)
{
images.Images.Clear();
lv.LargeImageList = images;
lv.SmallImageList = images;
string[] files = Directory.GetFiles(path, filter);
int i = 0;
foreach (string file in files)
{
images.Images.Add(Image.FromFile(file));
lv.Items.Add(new ListViewItem { ImageIndex = i++, Text = Path.GetFileNameWithoutExtension(file) });
}
}
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
For my numerology program I need to get a word file binded to a number. For example, when the outcome in a textbox is 9, it must call a word/XML/HTML document and place that in a word document. Every calculation has is own outcome, that makes a complete report.
The end result has to be something like this.
Word file 1: Introduction
word file 2: Outcome textbox 1
word file 3: Outcome textbox 2.
word file 4: Contact information
The report is textfile 1 to 4 in order placed in word, or PDF
I knoe how to use Report Wizard with simple text in code as object, but not a complete word file with pictures and lay-out.
Inspired greetings, Wilco
|
|
|
|
|
I'm working on a WPF app that allows the user to specify in XAML the source of data on an Attached Property.
<MyControl DataSource="App.VehicleInfo"/>
This string could reference any part of the app. Given a string like "App.VehicleInfo", how can I get the instance of the VehicleInfo class off the App at runtime?
If it's not broken, fix it until it is
|
|
|
|
|
The (WPF) Application class has a Properties collection that you can use to store a reference to "VehicleInfo" with a corresponding string key.
|
|
|
|
|
You can use the Reflection methods for that. There is a function that allows you to do this, Assembly.CreateInstance(string) [^].
But the problem is, you need to have the object type defined at the compile-time before you can cast the object created, to the one you need. Since you don't know that, I would suggest that you limit the instance creation variability to a few that your application knows. For more on this, please read, Activator.CreateInstance(String, String) [^].
Have a look at these documentations, you will get an idea. Both of them require a cast to a type.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
This sounds like something that would be better as a Markup Extension[^]. The ProvideValue method[^] will be passed an IServiceProvider instance, from which you can obtain an IXamlTypeResolver[^] instance which you can use to resolve types in exactly the same way as the rest of WPF - it will even work at design-time.
If you need to support generic types, it gets a bit more complicated because of changes made in .NET 4.0; you have to use a combination of IXamlNamespaceResolver and IXamlSchemaContextProvider to resolve the type:
var resolver = GetRequiredService<IXamlNamespaceResolver>(serviceProvider);
var schema = GetRequiredService<IXamlSchemaContextProvider>(serviceProvider);
var xamlNs = resolver.GetNamespace(namespaceName);
string genericTypeName = string.Format(CultureInfo.InvariantCulture, "{0}`{1:D}", typeName, typeArguments.Length);
var xamlTypeName = new XamlTypeName(xamlNs, genericTypeName);
Type genericType = schema.SchemaContext.GetXamlType(xamlTypeName).UnderlyingType;
Type finalType = genericType.MakeGenericType(typeArguments);
Markup Extension for Generic Classes[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
When Itry to fix this I got more errors what is going wrong in this code, to automate numerology. I'm a newby, please help.Inspired greetings, Rijk
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
abstract class MY_service
{
public static int getLifePathNumber(DateTime birthday)
{
int d = simplify(birthday.Day);
int m = simplify(birthday.Month);
int y = simplify(birthday.Year);
return simplify(d + m + y);
}
public static int getExpressionNumber(string first_name, string middle_name, string last_name)
{
int y1 = 0;
if (first_name != "")
{
y1 += simplify(ZetOm(first_name));
}
int y2 = 0;
if (middle_name != "")
{
y2 += simplify(ZetOm(middle_name));
}
int y3 = 0;
if (last_name != "")
{
y3 += simplify(ZetOm(last_name));
}
if (y3 != 0)
{
return simplify(y1 + y2 + y3);
}
else
{
System.Windows.Forms.MessageBox.Show("U dient minstens twee velden in te vullen.");
return 0;
}
}
public static int getMinorExpressionNumber(string First_daily_name_1, string Last_daily_names_1)
{
int y4 = 0;
if (First_daily_name_1 != "")
{
y4 += simplify(ZetOm(First_daily_name_1));
}
int y5 = 0;
if (Last_daily_names_1 != "")
{
y5 += simplify(ZetOm(Last_daily_names_1));
}
if (y5 != 0)
{
return simplify(y4 + y5);
}
else
{
System.Windows.Forms.MessageBox.Show("U dient minstens tween velden in te vullen.");
return 0;
}
}
public static int getBirthdayNumber(DateTime birthday)
{
int d = (birthday.Day);
return (d);
}
public static int getLEBridgeNumber(string Life_path_outcome, string Expression_outcome)
{
var convertedLifePathOutcome = (Life_path_outcome);
var L = simplify(convertedLifePathOutcome);
var convertedExpressionOutcome = (Expression_outcome);
var E = simplify(convertedExpressionOutcome);
var combined = L - E;
var result = simplify(combined);
return result;
}
public static int getMaturityNumber (string Life_path_outcome, string Expression_outcome)
{
var convertedLifePathOutcome = (Life_path_outcome);
var L = simplify(convertedLifePathOutcome);
var convertedExpressionOutcome = (Expression_outcome);
var E = simplify(convertedExpressionOutcome);
var combined = L + E;
var result = simplify(combined);
return result;
}
public static int RTN = getRationalThoughtNumber("", new DateTime(23,8,2014)) ;
textBox1.Text = RTN.ToString() + "\" + simplify(RTN).ToString();
{
// First, we reduce each unit (First) of the Full Name at Birth to a single-digit or a (masternumber?).
int y1 = 0;
if (first_name_1 != "")
{
y1 += simplify(ZetOm(first_name_1));
//First, we reduce each unit (month/day/year) of the birth date to a single-digit or a (masternumber?).
int d = simplify(birthday.Day);
int m = simplify(birthday.Month);
int y = simplify(birthday.Year);
//Next we add each of the resulting digits (or Master numbers) together and reduce the total again to a single-digit.
return y1 + d + m + y;
}else{
return 0;
//De uitkomst uit deze formule zou eigenlijk 43/7 (dit is niet vereenvoudigd 43 em vereenvoudigd 7 moeten zijn)
//zie hier hoe het met getallen werkt:
//Totaal 1e Geboortenaam + Geboortedatum en vereenvoudigen
//4 1 + 0 2 0 7 1 9 6 3 = 4 + 1 + 2 + 7 + 1 + 9 + 6 + 3 = 4 3 = 7
}
}
//Deze functie houdt rekening met masternumbers 11, 22, en 33
private static int simplify(string input)
{
//Spaties weghalen?
input = input.Replace("0", "");
//te grote waarde opsplitsen
if (input.Length > 7)
{
input = (simplify(input.Substring(0, 6)) + simplify(input.Substring(6, input.Length - 6))).ToString();
}
while (input.Length > 1 && input != "11" && input != "22" && input != "33")
{
int t = 0;
foreach (char c in input)
{
if (char.IsNumber(c))
{
t += int.Parse(c.ToString());
}
input = t.ToString();
}
}
return input!= "" ? int.Parse(input) : 0;
}
private static int simplify(int input)
{
return simplify(input.ToString());
}
public static int ZetOm(string input)
{
Dictionary<char, int> lijst = new Dictionary<char, int>()
{
{'a',1},
{'j',1},
{'s',1},
{'b',2},
{'k',2},
{'t',2},
{'c',3},
{'l',3},
{'u',3},
{'d',4},
{'m',4},
{'v',4},
{'e',5},
{'n',5},
{'w',5},
{'f',6},
{'o',6},
{'x',6},
{'g',7},
{'p',7},
{'y',7},
{'h',8},
{'q',8},
{'z',8},
{'i',9},
{'r',9},
};
string retVal = "";
foreach (char c in input)
{
int i;
lijst.TryGetValue(char.ToLower(c), out i);
retVal += i.ToString();
}
return simplify(retVal);
}
}
|
|
|
|
|
What errors?
When do you get them? What do you do to cause them?
Where?
And what have you tried to fix them?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
It is pretty rude to dump all of your code onto someone else and expect them to debug it all for you. So, please ask something specific pointing to a specific line item.
wilcoten wrote: When Itry to fix this I got more errors It's called debugging. You keep fixing the errors until they are all gone. There is no way around that.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Thanks for your advise, you're right, but I'm new in programming, so it is hard to find without the right knowledge. I have resolved a lot of warnings/errors, and now their are only 2, so I hope you can help me out with that.
This is the code:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace namespace Mysterious_You_1
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Mysterious_You_1());
}
}
}
And this the errors/warning:
Error 1 Identifier expected; 'namespace' is a keyword
Error 2 } expected
Warning 3 '2008' is not a valid warning number
I hope this is not rude :^)
|
|
|
|
|