Beispiel #1
0
        static void Main()
        {
            Utils.ReleaseMemory(true);
            using (var mutex = new Mutex(false, "Global\\ipsync_" + Application.StartupPath.GetHashCode()))
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                if (!mutex.WaitOne(0, false))
                {
                    var oldProcesses = Process.GetProcessesByName(Constants.APP_NAME);
                    if (oldProcesses.Length > 0)
                    {
                        var oldProcess = oldProcesses[0];
                    }
                    MessageBox.Show("Find Ipsync icon in your notify tray." + "\n" +
                                    "If you want to start multiple Ipsync, make a copy in another directory.",
                                    "Ipsync is already running.");
                    return;
                }
                Directory.SetCurrentDirectory(Application.StartupPath);

                //#if !DEBUG
                Logging.OpenLogFile();
                //#endif

                var controller     = new IpsyncController();
                var viewController = new MenuViewController(controller);

                controller.Start();
                Application.Run();
            }
        }
Beispiel #2
0
        public ConfigForm(IpsyncController controller)
        {
            _controller = controller;
            InitializeComponent();

            LoadConfiguration();
        }
Beispiel #3
0
        public MenuViewController(IpsyncController controller)
        {
            _controller = controller;
            LoadMenu();
            var config = Configuration.Load();

            _notifyIcon = new NotifyIcon
            {
                Visible     = true,
                ContextMenu = _contenxMenu
            };
            UpdateTrayIcon(config);
            _notifyIcon.MouseDoubleClick += NotifyIcon_MouseDoubleClick;

            LoadConfiguration(config);
            UpdateTrayText(config);

            controller.ConfigChanged += Controller_ConfigChanged;
            controller.IpChanged     += Controller_IpChanged;
        }