Esempio n. 1
0
 public FormsTrayApp()
 {
     syncCollectionDelegate = new SyncCollectionDelegate(syncCollection);
        syncFileDelegate = new SyncFileDelegate(syncFile);
        createChangeEventDelegate = new CreateChangeEventDelegate(createChangeEvent);
        notifyMessageDelegate = new NotifyMessageDelegate(notifyMessage);
     appRestart = Novell.Win32Util.Win32Window.RegisterWindowMsg("AppCreated");
     RegistryKey regKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Novell\iFolder");
     string language = regKey.GetValue("language") as String;
     if (language != null)
     {
         try
         {
             Thread.CurrentThread.CurrentUICulture = new CultureInfo(language);
         }
         catch { }
     }
        string windowName = FormsTrayApp.resourceManager.GetString("iFolderServices") + Environment.UserName;
        Novell.Win32Util.Win32Window window = Novell.Win32Util.Win32Window.FindWindow(null, windowName);
        if (window != null)
        {
         Novell.Win32Util.Win32Window iFolderWindow = Novell.Win32Util.Win32Window.FindWindow(null, resourceManager.GetString("myiFolders"));
         if (iFolderWindow != null)
         {
             iFolderWindow.SendMsg(HWND_BOARDCAST, appRestart, IntPtr.Zero, IntPtr.Zero);
         }
     shutdown = true;
        }
        else
        {
     iFolderLogPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "iFolder");
     if (!Directory.Exists(iFolderLogPath))
     {
      Directory.CreateDirectory(iFolderLogPath);
     }
     this.simiasManager = new Manager( Environment.GetCommandLineArgs() );
     InitializeComponent();
     this.Text = FormsTrayApp.resourceManager.GetString("iFolderServices") + Environment.UserName;
     this.components = new System.ComponentModel.Container();
     this.ClientSize = new System.Drawing.Size(292, 266);
     try
     {
      string basePath = Path.Combine(Application.StartupPath, "res");
      startupIcon = new Icon(Path.Combine(basePath, "ifolder_waiting_16.ico"));
      shutdownIcon = new Icon(Path.Combine(basePath, "ifolder_download_16.ico"));
      trayIcon = new Icon(Path.Combine(basePath, "ifolder_16.ico"));
      syncIcons[0] = new Icon(trayIcon, trayIcon.Size);
      for (int i = 0; i < numberOfSyncIcons; i++)
      {
       string syncIcon = string.Format(Path.Combine(basePath, "ifolder_sync{0}.ico"), i+1);
       syncIcons[i] = new Icon(syncIcon);
      }
      this.ShowInTaskbar = false;
      this.WindowState = FormWindowState.Minimized;
      Win32Window win32Window = new Win32Window();
      win32Window.Handle = this.Handle;
      win32Window.MakeToolWindow();
      shellNotifyIcon = new ShellNotifyIcon(this.Handle);
      shellNotifyIcon.Text = resourceManager.GetString("iFolderServicesStarting");
      shellNotifyIcon.Icon = startupIcon;
      if( !iFolderComponent.DisplayTrayIconEnabled )
                   shellNotifyIcon.Visible = false;
      shellNotifyIcon.ContextMenu = contextMenu1;
      shellNotifyIcon.Click += new Novell.CustomUIControls.ShellNotifyIcon.ClickDelegate(shellNotifyIcon_Click);
      shellNotifyIcon.BalloonClick += new Novell.CustomUIControls.ShellNotifyIcon.BalloonClickDelegate(shellNotifyIcon_BalloonClick);
      shellNotifyIcon.ContextMenuPopup += new Novell.CustomUIControls.ShellNotifyIcon.ContextMenuPopupDelegate(shellNotifyIcon_ContextMenuPopup);
         }
     catch
     {
     }
     }
        this.Closing += new System.ComponentModel.CancelEventHandler(this.FormsTrayApp_Closing);
        this.Load += new System.EventHandler(FormsTrayApp_Load);
 }
Esempio n. 2
0
 public void UnSubscribeNotifySystemMessage(NotifyMessageDelegate target)
 {
     OnSystemMessage -= target;
 }