Exemplo n.º 1
0
        /// <summary>
        /// Register
        /// </summary>
        private void Register()
        {
            ifdata = iFolderData.GetData();

            simiasEventClient = new IProcEventClient(
                new IProcEventError(ErrorHandler), null);

            simiasEventClient.Register();

            simiasEventClient.SetEvent(IProcEventAction.AddNodeCreated,
                                       new IProcEventHandler(SimiasEventHandler));

            simiasEventClient.SetEvent(IProcEventAction.AddNodeChanged,
                                       new IProcEventHandler(SimiasEventHandler));

            simiasEventClient.SetEvent(IProcEventAction.AddNodeDeleted,
                                       new IProcEventHandler(SimiasEventHandler));

            simiasEventClient.SetEvent(IProcEventAction.AddCollectionSync,
                                       new IProcEventHandler(SimiasEventSyncCollectionHandler));

            simiasEventClient.SetEvent(IProcEventAction.AddFileSync,
                                       new IProcEventHandler(SimiasEventSyncFileHandler));

            simiasEventClient.SetEvent(IProcEventAction.AddNotifyMessage,
                                       new IProcEventHandler(SimiasEventNotifyHandler));

            runEventThread = true;
            SEThread.Start();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Deresgister
        /// </summary>
        public void Deregister()
        {
            try
            {
                if (simiasEventClient != null)
                {
                    simiasEventClient.Deregister();
                    simiasEventClient = null;
                }
            }
            catch (Exception)
            {
                // ignore
            }

            runEventThread = false;
        }
Exemplo n.º 3
0
 private void FormsTrayApp_Load(object sender, System.EventArgs e)
 {
     if (shutdown)
        {
     this.Close();
        }
        else
        {
         try
         {
             if (!Preferences.HideiFolderInTray)
             {
                 ShowStartupScreen();
             }
             Environment.CurrentDirectory = Application.StartupPath;
             for (int i = 0; i < 3; i++)
             {
                 Process[] processArray = Process.GetProcessesByName("simias");
                 foreach (Process proc in processArray)
                 {
                     if (proc != null)
                     {
                         simiasManager.Stop();
                     }
                 }
             }
             ifWebService = null;
             simiasWebService = null;
             eventQueue = new Queue();
             workEvent = new AutoResetEvent(false);
             eventClient = new IProcEventClient(new IProcEventError(errorHandler), null);
             preferences = new Preferences(ifWebService, simiasWebService, simiasManager);
             preferences.EnterpriseConnect += new Novell.FormsTrayApp.Preferences.EnterpriseConnectDelegate(preferences_EnterpriseConnect);
             preferences.ChangeDefaultDomain += new Novell.FormsTrayApp.Preferences.ChangeDefaultDomainDelegate(preferences_EnterpriseConnect);
             preferences.RemoveDomain += new Novell.FormsTrayApp.Preferences.RemoveDomainDelegate(preferences_RemoveDomain);
             preferences.ShutdownTrayApp += new Novell.FormsTrayApp.Preferences.ShutdownTrayAppDelegate(preferences_ShutdownTrayApp);
             preferences.UpdateDomain += new Novell.FormsTrayApp.Preferences.UpdateDomainDelegate(preferences_UpdateDomain);
             preferences.DisplayiFolderDialog += new Novell.FormsTrayApp.Preferences.DisplayiFolderDialogDelegate(preferences_DisplayiFolderDialog);
             preferences.CreateControl();
             IntPtr handle = preferences.Handle;
             syncLog = new SyncLog();
             syncLog.CreateControl();
             handle = syncLog.Handle;
             infolog = new SyncLog();
             infolog.Customize();
             globalProperties = new GlobalProperties(ifWebService, simiasWebService, eventClient);
             globalProperties.RemoveDomain += new Novell.FormsTrayApp.GlobalProperties.RemoveDomainDelegate(globalProperties_RemoveDomain);
             globalProperties.PreferenceDialog = preferences;
             globalProperties.SyncLogDialog = syncLog;
             globalProperties.CreateControl();
             handle = globalProperties.Handle;
             if (RegularStart)
             {
                 DelayedStart();
             }
             else
             {
                 try
                 {
                     LogInit();
                 }
                 catch { }
                 shellNotifyIcon.Text = resourceManager.GetString("iFolderServices");
                 shellNotifyIcon.Icon = trayIcon;
                 SimiasTimer = new System.Windows.Forms.Timer();
                 SimiasTimer.Interval = 120000;
                 SimiasTimer.Tick += new EventHandler(SimiasTimer_Tick);
                 SimiasTimer.Start();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(string.Format("Exception: {0}--{1}", ex.Message, ex.StackTrace));
             ShutdownTrayApp(ex);
         }
         finally
         {
             CloseStartupScreen();
         }
        }
 }
Exemplo n.º 4
0
 public GlobalProperties(iFolderWebService ifolderWebService, SimiasWebService simiasWebService, IProcEventClient eventClient)
 {
     syncCollectionDelegate = new SyncCollectionDelegate(syncCollection);
     syncFileDelegate = new SyncFileDelegate(syncFile);
     createChangeEventDelegate = new CreateChangeEventDelegate(createChangeEvent);
     deleteEventDelegate = new DeleteEventDelegate(deleteEvent);
     addDomainToListDelegate = new AddDomainToListDelegate(AddDomainToList);
     refreshiFoldersDelegate = new RefreshiFoldersDelegate(refreshiFoldersInvoke);
     InitializeComponent();
     MoreInitialization();
     PluginEnhancedMenu();
     infoMessage = new NoiFolderMessage();
     panel2.Controls.Add(infoMessage);
     progressBar1.Visible = false;
     ifWebService = ifolderWebService;
     this.simiasWebService = simiasWebService;
     this.eventClient = eventClient;
     eventClient.SetEvent(IProcEventAction.AddCollectionSync, new IProcEventHandler(global_collectionSyncHandler));
     eventClient.SetEvent(IProcEventAction.AddFileSync, new IProcEventHandler(global_fileSyncHandler));
     updateEnterpriseTimer = new System.Timers.Timer(1000);
     updateEnterpriseTimer.AutoReset = false;
     updateEnterpriseTimer.Elapsed += new System.Timers.ElapsedEventHandler(updateEnterpriseTimer_Elapsed);
     ht = new Hashtable();
     progressBar1.Minimum = 0;
     this.StartPosition = FormStartPosition.CenterScreen;
     try
     {
         this.Icon = new Icon(Path.Combine(Application.StartupPath, @"res\ifolder_16.ico"));
         largeImageList = new ImageList();
         largeImageList.ImageSize = new Size(48, 48);
         largeImageList.ColorDepth = ColorDepth.Depth32Bit;
         largeImageList.TransparentColor = Color.Black;
         largeImageList.Images.Add(Bitmap.FromFile(Path.Combine(Application.StartupPath, @"res\ifolder48.png")));
         largeImageList.Images.Add(Bitmap.FromFile(Path.Combine(Application.StartupPath, @"res\ifolder-sync48.png")));
         largeImageList.Images.Add(Bitmap.FromFile(Path.Combine(Application.StartupPath, @"res\ifolder-download48.png")));
         largeImageList.Images.Add(Bitmap.FromFile(Path.Combine(Application.StartupPath, @"res\ifolder-upload48.png")));
         largeImageList.Images.Add(Bitmap.FromFile(Path.Combine(Application.StartupPath, @"res\ifolder-waiting48.png")));
         largeImageList.Images.Add(Bitmap.FromFile(Path.Combine(Application.StartupPath, @"res\ifolder-conflict48.png")));
         largeImageList.Images.Add(Bitmap.FromFile(Path.Combine(Application.StartupPath, @"res\ifolder-error48.png")));
         largeImageList.Images.Add(Bitmap.FromFile(Path.Combine(Application.StartupPath, @"res\encrypt_ilock_48.gif")));
         largeImageList.Images.Add(Bitmap.FromFile(Path.Combine(Application.StartupPath, @"res\ifolder_user_48.png")));
         largeImageList.Images.Add(Bitmap.FromFile(Path.Combine(Application.StartupPath, @"res\ifolder-warning48.png")));
         iFolderView.LargeImageList = largeImageList;
     }
     catch { }
 }
Exemplo n.º 5
0
 private void iFolderAdvanced_Load(object sender, EventArgs e)
 {
     string helpFile = Path.Combine(Path.Combine(Path.Combine(loadPath, "help"), GetLanguageDirectory()), @"sharewith.html");
        if (!File.Exists(helpFile))
        {
     helpFile = Path.Combine(loadPath, @"help\en\sharewith.html");
        }
        if (File.Exists(helpFile))
        {
     helpProvider1.HelpNamespace = helpFile;
        }
        try
        {
     shareWith.SmallImageList = new ImageList();
     string basePath = loadPath != null ? Path.Combine(loadPath, "res") : Path.Combine(Application.StartupPath, "res");
     shareWith.SmallImageList.Images.Add(new Icon(Path.Combine(basePath, "ifolder_me_card.ico")));
     shareWith.SmallImageList.Images.Add(new Icon(Path.Combine(basePath, "ifolder_contact_card.ico")));
     shareWith.SmallImageList.Images.Add(new Icon(Path.Combine(basePath, "inviteduser.ico")));
         this.Text = this.currentiFolder.Name + " " + resourceManager.GetString("properties");
     this.Icon = new Icon(Path.Combine(basePath, @"ifolder_16.ico"));
     this.pictureBox1.Image = Image.FromFile(System.IO.Path.Combine(loadPath, @"res\ifolder48.png"));
         this.iFolderName.Text = this.currentiFolder.Name;
         if (this.currentiFolder.Name.Length > 20)
             this.iFolderName.Text = this.currentiFolder.Name.Substring(0,20) + "...";
         if (this.currentiFolder.UnManagedPath.ToString().Length > 30)
     this.iFolderLocation.Text = ((string)this.currentiFolder.UnManagedPath).Substring(0,30);
         else
             this.iFolderLocation.Text = ((string)this.currentiFolder.UnManagedPath).ToString();
     this.iFolderOwner.Text = this.currentiFolder.Owner;
     this.iFolderAccount.Text = this.domainName;
         this.ssl.Checked = this.currentiFolder.ssl;
        }
        catch {}
        subscrHT = new Hashtable();
        userIDHT = new Hashtable();
        if (eventClient == null)
        {
     eventClient = new IProcEventClient(new IProcEventError(errorHandler), null);
     existingEventClient = false;
     eventClient.Register();
        }
        if (!eventError)
        {
     eventClient.SetEvent(IProcEventAction.AddNodeChanged, new IProcEventHandler(nodeEventHandler));
     eventClient.SetEvent(IProcEventAction.AddNodeCreated, new IProcEventHandler(nodeEventHandler));
     eventClient.SetEvent(IProcEventAction.AddNodeDeleted, new IProcEventHandler(nodeEventHandler));
     eventClient.SetEvent(IProcEventAction.AddCollectionSync, new IProcEventHandler(collectionSyncHandler));
     eventClient.SetEvent(IProcEventAction.AddFileSync, new IProcEventHandler(fileSyncHandler));
        }
        try
        {
     connectToWebService();
     refreshData();
        }
        catch (WebException ex)
        {
     MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("iFolderReadError"), resourceManager.GetString("errorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
     mmb.ShowDialog();
     if (ex.Status == WebExceptionStatus.ConnectFailure)
     {
      ifWebService = null;
     }
        }
        catch (Exception ex)
        {
     MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("iFolderReadError"), resourceManager.GetString("errorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
     mmb.ShowDialog();
        }
 }
Exemplo n.º 6
0
 private void Register()
 {
     ifdata = iFolderData.GetData();
        simiasEventClient = new IProcEventClient(
      new IProcEventError( ErrorHandler), null);
        simiasEventClient.Register();
        simiasEventClient.SetEvent( IProcEventAction.AddNodeCreated,
     new IProcEventHandler( SimiasEventHandler ) );
        simiasEventClient.SetEvent( IProcEventAction.AddNodeChanged,
     new IProcEventHandler( SimiasEventHandler ) );
        simiasEventClient.SetEvent( IProcEventAction.AddNodeDeleted,
     new IProcEventHandler( SimiasEventHandler ) );
        simiasEventClient.SetEvent( IProcEventAction.AddCollectionSync,
     new IProcEventHandler( SimiasEventSyncCollectionHandler) );
        simiasEventClient.SetEvent( IProcEventAction.AddFileSync,
     new IProcEventHandler( SimiasEventSyncFileHandler) );
        simiasEventClient.SetEvent( IProcEventAction.AddNotifyMessage,
     new IProcEventHandler( SimiasEventNotifyHandler) );
        runEventThread = true;
        SEThread.Start();
 }
Exemplo n.º 7
0
 public void Deregister()
 {
     try
        {
     if (simiasEventClient != null)
     {
      simiasEventClient.Deregister();
      simiasEventClient = null;
     }
        }
        catch(Exception e)
        {
        }
        runEventThread = false;
 }
Exemplo n.º 8
0
 public GlobalProperties(iFolderWebService ifolderWebService, SimiasWebService simiasWebService, IProcEventClient eventClient)
 {
     syncCollectionDelegate = new SyncCollectionDelegate(syncCollection);
        syncFileDelegate = new SyncFileDelegate(syncFile);
        createChangeEventDelegate = new CreateChangeEventDelegate(createChangeEvent);
        deleteEventDelegate = new DeleteEventDelegate(deleteEvent);
        InitializeComponent();
        progressBar1.Visible = false;
        ifWebService = ifolderWebService;
        this.simiasWebService = simiasWebService;
        this.eventClient = eventClient;
        eventClient.SetEvent(IProcEventAction.AddCollectionSync, new IProcEventHandler(global_collectionSyncHandler));
        eventClient.SetEvent(IProcEventAction.AddFileSync, new IProcEventHandler(global_fileSyncHandler));
        updateEnterpriseTimer = new System.Timers.Timer(1000);
        updateEnterpriseTimer.AutoReset = false;
        updateEnterpriseTimer.Elapsed += new System.Timers.ElapsedEventHandler(updateEnterpriseTimer_Elapsed);
        ht = new Hashtable();
        progressBar1.Minimum = 0;
        this.StartPosition = FormStartPosition.CenterScreen;
        try
        {
     this.Icon = new Icon(Path.Combine(Application.StartupPath, @"ifolder_app.ico"));
     this.iFolderView.SmallImageList = new ImageList();
     iFolderView.SmallImageList.Images.Add(new Icon(Path.Combine(Application.StartupPath, @"res\ifolder_loaded.ico")));
     iFolderView.SmallImageList.Images.Add(new Icon(Path.Combine(Application.StartupPath, @"res\serverifolder.ico")));
     iFolderView.SmallImageList.Images.Add(new Icon(Path.Combine(Application.StartupPath, @"res\ifolderconflict.ico")));
     toolBar1.ImageList = new ImageList();
     toolBar1.ImageList.ImageSize = new Size(24, 24);
     toolBar1.ImageList.TransparentColor = Color.White;
     toolBar1.ImageList.Images.AddStrip(Image.FromFile(Path.Combine(Application.StartupPath, @"res\mtoolbar_nor.bmp")));
     toolBar1.DisabledImageList = new ImageList();
     toolBar1.DisabledImageList.ImageSize = new Size(24, 24);
     toolBar1.DisabledImageList.TransparentColor = Color.White;
     toolBar1.DisabledImageList.Images.AddStrip(Image.FromFile(Path.Combine(Application.StartupPath, @"res\mtoolbar_dis.bmp")));
     toolBar1.HotImageList = new ImageList();
     toolBar1.HotImageList.ImageSize = new Size(24, 24);
     toolBar1.HotImageList.TransparentColor = Color.White;
     toolBar1.HotImageList.Images.AddStrip(Image.FromFile(Path.Combine(Application.StartupPath, @"res\mtoolbar_hot.bmp")));
     toolBarCreate.ImageIndex = 0;
     toolBarSetup.ImageIndex = 1;
     toolBarShare.ImageIndex = 2;
     toolBarResolve.ImageIndex = 3;
     toolBarSync.ImageIndex = 4;
        }
        catch {}
        this.MinimumSize = this.Size;
 }
Exemplo n.º 9
0
 private void iFolderAdvanced_Load(object sender, EventArgs e)
 {
     string helpFile = Path.Combine(Path.Combine(Path.Combine(loadPath, "help"), GetLanguageDirectory()), @"doc\u0000\data\sharewith.html");
        if (!File.Exists(helpFile))
        {
     helpFile = Path.Combine(loadPath, @"help\en\doc\u0000\data\sharewith.html");
        }
        if (File.Exists(helpFile))
        {
     helpProvider1.HelpNamespace = helpFile;
        }
        try
        {
     shareWith.SmallImageList = new ImageList();
     string basePath = loadPath != null ? Path.Combine(loadPath, "res") : Path.Combine(Application.StartupPath, "res");
     shareWith.SmallImageList.Images.Add(new Icon(Path.Combine(basePath, "ifolder_me_card.ico")));
     shareWith.SmallImageList.Images.Add(new Icon(Path.Combine(basePath, "ifolder_contact_card.ico")));
     shareWith.SmallImageList.Images.Add(new Icon(Path.Combine(basePath, "inviteduser.ico")));
     this.Icon = new Icon(Path.Combine(basePath, @"..\ifolder_app.ico"));
     conflictIcon.Image = new Icon(new Icon(Path.Combine(basePath, "ifolderconflict.ico")), 32, 32).ToBitmap();
        }
        catch {}
        subscrHT = new Hashtable();
        userIDHT = new Hashtable();
        if (eventClient == null)
        {
     eventClient = new IProcEventClient(new IProcEventError(errorHandler), null);
     existingEventClient = false;
     eventClient.Register();
        }
        if (!eventError)
        {
     eventClient.SetEvent(IProcEventAction.AddNodeChanged, new IProcEventHandler(nodeEventHandler));
     eventClient.SetEvent(IProcEventAction.AddNodeCreated, new IProcEventHandler(nodeEventHandler));
     eventClient.SetEvent(IProcEventAction.AddNodeDeleted, new IProcEventHandler(nodeEventHandler));
     eventClient.SetEvent(IProcEventAction.AddCollectionSync, new IProcEventHandler(collectionSyncHandler));
     eventClient.SetEvent(IProcEventAction.AddFileSync, new IProcEventHandler(fileSyncHandler));
        }
        try
        {
     connectToWebService();
     iFolderWeb[] ifolderArray = ifWebService.GetAlliFolders();
     foreach (iFolderWeb i in ifolderArray)
     {
      if ((i.Type != null) && i.Type.Equals("iFolder") &&
       !i.IsSubscription)
      {
       if (longName.Length < i.UnManagedPath.Length)
       {
        longName = i.UnManagedPath;
       }
       iFolderInfo ifolderInfo = new iFolderInfo();
       ifolderInfo.LocalPath = i.UnManagedPath;
       ifolderInfo.ID = i.ID;
       ifolders.Items.Add(ifolderInfo);
       if ((currentiFolder != null) && currentiFolder.ID.Equals(ifolderInfo.ID))
       {
        ifolders.SelectedItem = ifolderInfo;
       }
      }
     }
        }
        catch (WebException ex)
        {
     MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("iFolderReadError"), resourceManager.GetString("errorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
     mmb.ShowDialog();
     if (ex.Status == WebExceptionStatus.ConnectFailure)
     {
      ifWebService = null;
     }
        }
        catch (Exception ex)
        {
     MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("iFolderReadError"), resourceManager.GetString("errorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
     mmb.ShowDialog();
        }
 }
Exemplo n.º 10
0
 private void FormsTrayApp_Load(object sender, System.EventArgs e)
 {
     if (shutdown)
        {
     this.Close();
        }
        else
        {
     try
     {
      Environment.CurrentDirectory = Application.StartupPath;
      simiasManager.Start();
      SetWebServiceInformation(simiasManager.WebServiceUri, simiasManager.DataPath);
      ifWebService = new iFolderWebService();
      ifWebService.Url = simiasManager.WebServiceUri + "/iFolder.asmx";
      simiasWebService = new SimiasWebService();
      simiasWebService.Url = simiasManager.WebServiceUri + "/Simias.asmx";
      eventQueue = new Queue();
      workEvent = new AutoResetEvent(false);
      eventClient = new IProcEventClient(new IProcEventError(errorHandler), null);
      eventClient.Register();
      if (!eventError)
      {
       eventClient.SetEvent(IProcEventAction.AddNodeChanged, new IProcEventHandler(trayApp_nodeEventHandler));
       eventClient.SetEvent(IProcEventAction.AddNodeCreated, new IProcEventHandler(trayApp_nodeEventHandler));
       eventClient.SetEvent(IProcEventAction.AddNodeDeleted, new IProcEventHandler(trayApp_nodeEventHandler));
       eventClient.SetEvent(IProcEventAction.AddCollectionSync, new IProcEventHandler(trayApp_collectionSyncHandler));
       eventClient.SetEvent(IProcEventAction.AddFileSync, new IProcEventHandler(trayApp_fileSyncHandler));
       eventClient.SetEvent(IProcEventAction.AddNotifyMessage, new IProcEventHandler(trayApp_notifyMessageHandler));
      }
      preferences = new Preferences(ifWebService, simiasWebService, simiasManager);
      preferences.EnterpriseConnect += new Novell.FormsTrayApp.Preferences.EnterpriseConnectDelegate(preferences_EnterpriseConnect);
      preferences.ChangeDefaultDomain += new Novell.FormsTrayApp.Preferences.ChangeDefaultDomainDelegate(preferences_EnterpriseConnect);
      preferences.RemoveDomain += new Novell.FormsTrayApp.Preferences.RemoveDomainDelegate(preferences_RemoveDomain);
      preferences.ShutdownTrayApp += new Novell.FormsTrayApp.Preferences.ShutdownTrayAppDelegate(preferences_ShutdownTrayApp);
      preferences.UpdateDomain += new Novell.FormsTrayApp.Preferences.UpdateDomainDelegate(preferences_UpdateDomain);
      preferences.CreateControl();
      IntPtr handle = preferences.Handle;
      syncLog = new SyncLog();
      syncLog.CreateControl();
      handle = syncLog.Handle;
      LocalService.Start(simiasWebService, simiasManager.WebServiceUri, simiasManager.DataPath);
      LocalService.Start(ifWebService, simiasManager.WebServiceUri, simiasManager.DataPath);
      simiasRunning = true;
      globalProperties = new GlobalProperties(ifWebService, simiasWebService, eventClient);
      globalProperties.RemoveDomain += new Novell.FormsTrayApp.GlobalProperties.RemoveDomainDelegate(globalProperties_RemoveDomain);
      globalProperties.PreferenceDialog = preferences;
      globalProperties.SyncLogDialog = syncLog;
      globalProperties.CreateControl();
      handle = globalProperties.Handle;
      bool accountPrompt = false;
      try
      {
       globalProperties.InitializeServerList();
       DomainInformation[] domains;
       domains = this.simiasWebService.GetDomains(false);
       foreach(DomainInformation dw in domains)
       {
        try
        {
     if (dw.IsSlave)
     {
      preferences.AddDomainToList(dw);
     }
     globalProperties.AddDomainToList(dw);
     preferences.SetProxyForDomain( dw.HostUrl, false );
        }
        catch {}
       }
       if (domains.Length.Equals(0))
       {
        accountPrompt = true;
       }
      }
      catch {}
      if (worker == null)
      {
       worker = new Thread(new ThreadStart(eventThreadProc));
       worker.Start();
      }
      shellNotifyIcon.Text = resourceManager.GetString("iFolderServices");
      shellNotifyIcon.Icon = trayIcon;
      updateOverlayIcons();
      if (accountPrompt)
      {
       notifyType = NotifyType.CreateAccount;
       shellNotifyIcon.DisplayBalloonTooltip(resourceManager.GetString("createAccountTitle"), resourceManager.GetString("createAccount"), BalloonType.Info);
      }
     }
     catch (Exception ex)
     {
      ShutdownTrayApp(ex);
     }
        }
 }