-
Notifications
You must be signed in to change notification settings - Fork 201
/
Copy pathProgram.cs
64 lines (55 loc) · 2.17 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
using System.Globalization;
using System.Windows.Forms;
namespace fyiReporting.RdlDesign
{
public class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
string version = typeof(Program).Assembly.GetName().Version.ToString().Replace(".", "");
string ipcChannelPortName = string.Format("RdlProject{0}", version);
// Determine if an instance is already running?
bool firstInstance;
string mName = string.Format("Local\\RdlDesigner{0}", version);
// can't use Assembly in this context
System.Threading.Mutex mutex = new System.Threading.Mutex(false, mName, out firstInstance);
if (firstInstance)
{// just start up the designer when we're first in line
var thread = System.Threading.Thread.CurrentThread;
try
{
if (DialogToolOptions.DesktopConfiguration.Language != null)
{
thread.CurrentCulture = new CultureInfo(DialogToolOptions.DesktopConfiguration.Language);
}
else
{
thread.CurrentCulture = new CultureInfo(thread.CurrentCulture.Name);
}
}
catch
{
thread.CurrentCulture = new CultureInfo(thread.CurrentCulture.Name);
}
if (thread.CurrentCulture.Equals(CultureInfo.InvariantCulture))
{
thread.CurrentCulture = new CultureInfo("en-US");
}
// for working in non-default cultures
thread.CurrentCulture.NumberFormat.NumberDecimalSeparator = ".";
thread.CurrentUICulture = thread.CurrentCulture;
Application.EnableVisualStyles();
Application.DoEvents();
Application.Run(new RdlDesigner(ipcChannelPortName, true));
return;
}
// Process already running. Notify other process that is might need to open another file
string[] args = Environment.GetCommandLineArgs();
}
}
}