/// <summary> /// Display the iFolder help. /// </summary> /// <param name="dllPath">The path where this assembly was loaded from.</param> public void ShowHelp([MarshalAs(UnmanagedType.LPWStr)] string dllPath, [MarshalAs(UnmanagedType.LPWStr)] string helpFile) { // TODO: - may need to pass in a specific page to load. string defaulthelpfile = "bookinfo.html"; string helpPath = helpFile.Equals(string.Empty) ? Path.Combine(Path.Combine(Path.Combine(dllPath, "help"), GetLanguageDirectory()), defaulthelpfile) : Path.Combine(Path.Combine(Path.Combine(dllPath, "help"), GetLanguageDirectory()), helpFile); if (!File.Exists(helpPath)) { // Fall back to English if the language isn't installed. helpPath = helpFile.Equals(string.Empty) ? Path.Combine(dllPath, @"help\en\bookinfo.html") : Path.Combine(Path.Combine(dllPath, @"help\en"), helpFile); } try { Process.Start(helpPath); } catch (Exception e) { MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("helpFileError") + "\n" + helpPath, resourceManager.GetString("helpErrorTitle"), e.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } }
/// <summary> /// Event Handler for ServerInfo load event /// </summary> private void ServerInfo_Load(object sender, System.EventArgs e) { // Load the application icon. try { this.Icon = new Icon(Path.Combine(Application.StartupPath, @"res\ifolder_16.ico")); banner.Image = Image.FromFile(Path.Combine(Application.StartupPath, @"res\ifolder-banner.png")); bannerFill.SizeMode = PictureBoxSizeMode.StretchImage; bannerFill.Image = Image.FromFile(Path.Combine(Application.StartupPath, @"res\ifolder-banner-scaler.png")); } catch { // Ignore. } try { simiasWebService = new SimiasWebService(); simiasWebService.Url = simiasManager.WebServiceUri.ToString() + "/Simias.asmx"; LocalService.Start(simiasWebService, simiasManager.WebServiceUri, simiasManager.DataPath); if (domainInfo != null) { serverName.Text = domainInfo.Name; userName.Text = domainInfo.MemberName; } } catch (Exception ex) { Novell.iFolderCom.MyMessageBox mmb = new Novell.iFolderCom.MyMessageBox(resourceManager.GetString("domainInfoReadError"), string.Empty, ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } }
/// <summary> /// Reverts the specified path back to a normal folder. Also remove iFolder / Membership. /// </summary> /// <param name="path">The path to revert back to a normal folder.</param> public void RevertToNormal([MarshalAs(UnmanagedType.LPWStr)] string path) { Cursor.Current = Cursors.WaitCursor; try { connectToWebService(); RevertiFolder revertiFolder = new RevertiFolder(); iFolderWeb ifolder = ifWebService.GetiFolderByLocalPath(path); bool IsMaster = (ifolder.CurrentUserID == ifolder.OwnerID); if (!IsMaster) { revertiFolder.removeFromServer.Text = resourceManager.GetString("AlsoRemoveMembership"); } revertiFolder.removeFromServer.Enabled = simws.GetDomainInformation(ifolder.DomainID).Authenticated; if (revertiFolder.ShowDialog() == DialogResult.Yes) { Cursor.Current = Cursors.WaitCursor; if (ifWebService != null && ifolder != null) { ifWebService.RevertiFolder(ifolder.ID); if (revertiFolder.RemoveFromServer) { if (IsMaster) { ifWebService.DeleteiFolder(ifolder.DomainID, ifolder.ID); } else { ifWebService.DeclineiFolderInvitation(ifolder.DomainID, ifolder.ID); } } } } revertiFolder.Dispose(); } catch (WebException e) { ifWebService = null; if (e.Status == WebExceptionStatus.ProtocolError) { LocalService.ClearCredentials(); } } catch (Exception e) { Cursor.Current = Cursors.Default; Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("iFolderRevertError"), resourceManager.GetString("revertErrorTitle"), e.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); mmb.Dispose(); } Cursor.Current = Cursors.Default; }
/// <summary> /// Displays the Advanced Properties dialog for the specified iFolder. /// </summary> /// <param name="dllPath">The path where the assembly was loaded from.</param> /// <param name="path">The path of the iFolder.</param> /// <param name="tabPage">The index of the tab to display initially.</param> /// <param name="modal">Set to <b>true</b> to display the dialog modal.</param> public void InvokeAdvancedDlg([MarshalAs(UnmanagedType.LPWStr)] string dllPath, [MarshalAs(UnmanagedType.LPWStr)] string path, int tabPage, bool modal) { string windowName = string.Format(resourceManager.GetString("iFolderProperties"), Path.GetFileName(path)); // Search for existing window and bring it to foreground ... Win32Window win32Window = Win32Util.Win32Window.FindWindow(null, windowName); if (win32Window != null) { win32Window.BringWindowToTop(); } else { try { iFolderAdvanced ifolderAdvanced = new iFolderAdvanced(); ifolderAdvanced.Name = path; ifolderAdvanced.Text = windowName; connectToWebService(); ifolderAdvanced.CurrentiFolder = ifWebService.GetiFolderByLocalPath(path); ifolderAdvanced.LoadPath = dllPath; ifolderAdvanced.ActiveTab = tabPage; ifolderAdvanced.DomainName = (simws.GetDomainInformation((ifWebService.GetiFolderByLocalPath(path)).DomainID)).Name; ifolderAdvanced.DomainUrl = (simws.GetDomainInformation((ifWebService.GetiFolderByLocalPath(path)).DomainID)).HostUrl; if (modal) { ifolderAdvanced.ShowDialog(); } else { ifolderAdvanced.Show(); } } catch (WebException e) { MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("propertiesDialogError"), resourceManager.GetString("propertiesErrorTitle"), e.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); ifWebService = null; if (e.Status == WebExceptionStatus.ProtocolError) { LocalService.ClearCredentials(); } } catch (Exception e) { MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("propertiesDialogError"), resourceManager.GetString("propertiesErrorTitle"), e.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } } }
/// <summary> /// Displays the Conflict Resolver dialog for the specified iFolder. /// </summary> /// <param name="dllPath">The path where the assembly was loaded from.</param> /// <param name="path">The path of the iFolder.</param> public void InvokeConflictResolverDlg([MarshalAs(UnmanagedType.LPWStr)] string dllPath, [MarshalAs(UnmanagedType.LPWStr)] string path) { try { iFolderWeb ifolder = ifWebService.GetiFolderByLocalPath(path); if (!iFolderComponent.AdvancedConflictResolver(ifWebService, ifolder)) { ConflictResolver conflictResolver = new ConflictResolver(); conflictResolver.iFolder = ifolder; conflictResolver.iFolderWebService = ifWebService; conflictResolver.LoadPath = dllPath; conflictResolver.Show(); } } catch (Exception ex) { MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("conflictDialogError"), resourceManager.GetString("conflictErrorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } }
private void menuImportKeys_Select(object sender, EventArgs e) { ImportKeysDialog importKeys = new ImportKeysDialog(this.simiasWebService,this.ifWebService); if( importKeys.DomainCount > 0) importKeys.ShowDialog(); else { System.Resources.ResourceManager Resource = new System.Resources.ResourceManager(typeof(FormsTrayApp)); Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(Resource.GetString("NoLoggedInDomainsTextForImport"), Resource.GetString("ImportKeysError"), "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); mmb.Dispose(); } }
private void ShutdownTrayApp(Exception ex) { if (preferences != null) preferences.Hide(); if (globalProperties != null) globalProperties.Hide(); if (syncLog != null) syncLog.Hide(); if (infolog != null) infolog.Hide(); Cursor.Current = Cursors.WaitCursor; if (shellNotifyIcon != null) { shellNotifyIcon.Text = resourceManager.GetString("iFolderServicesStopping"); shellNotifyIcon.Icon = shutdownIcon; } if (ex != null) { Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("fatalErrorMessage"), resourceManager.GetString("fatalErrorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } simiasRunning = false; iFolderComponent.SimiasRunning = false; try { if (eventClient != null) { eventClient.Deregister(); } if(this.MachineShutdown() == false && globalProperties.MachineShutdown() == false && preferences.MachineShutdown() == false && syncLog.MachineShutdown() == false) { simiasManager.Stop(); } if ((worker != null) && worker.IsAlive) { worker.Abort(); } } catch { } Cursor.Current = Cursors.Default; Application.Exit(); }
private bool processChanges() { bool result = true; Cursor.Current = Cursors.WaitCursor; if (autoStart.Checked != IsRunEnabled()) { setAutoRunValue(!autoStart.Checked); } NotifyShareEnabled = notifyShared.Checked; NotifyCollisionEnabled = notifyCollisions.Checked; NotifyJoinEnabled = notifyJoins.Checked; HideiFolderInTray = startInTrayIcon.Checked; HideSyncLogWindow = hideSyncLog.Checked; HidePolicyVoilationNotification = hidenotification.Checked; iFolderComponent.DisplayConfirmationEnabled = displayConfirmation.Checked; iFolderComponent.DisplayTrayIconEnabled = !(displayTrayIcon.Checked); if (displayTrayIcon.Checked) FormsTrayApp.SetTrayIconStatus(false); else FormsTrayApp.SetTrayIconStatus(true); try { ListBox.SelectedIndexCollection selectedIndex = policylistbox.SelectedIndices; if (notifyCheckbox.Checked) { NotifyPolicyQouta = false; NotifyPolicySize = false; NotifyPolicyType = false; NotifyDiskFull = false; NotifyIOPermission = false; NotifyPathLong = false; foreach (int index in selectedIndex) { switch (index) { case (int)policyVoilation.QuotaVoliation: NotifyPolicyQouta = true; break; case (int)policyVoilation.FileSizeVoilation: NotifyPolicySize = true; break; case (int)policyVoilation.FileTypeVoilation: NotifyPolicyType = true; break; case (int)policyVoilation.DiskFullVoilation: NotifyDiskFull = true; break; case (int)policyVoilation.PremissionUnavailable: NotifyIOPermission = true; break; case (int)policyVoilation.LongPath: NotifyPathLong = true; break; default: FormsTrayApp.log.Debug("invalid index"); break; } } } decimal syncValueInSeconds; if (((string)timeUnit.SelectedItem).Equals(resourceManager.GetString("days"))) { syncValueInSeconds = defaultInterval.Value * 86400; } else if (((string)timeUnit.SelectedItem).Equals(resourceManager.GetString("hours"))) { syncValueInSeconds = defaultInterval.Value * 3600; } else if (((string)timeUnit.SelectedItem).Equals(resourceManager.GetString("minutes"))) { syncValueInSeconds = defaultInterval.Value * 60; } else { syncValueInSeconds = defaultInterval.Value; } int currentInterval = ifWebService.GetDefaultSyncInterval(); if ((!syncValueInSeconds.Equals((decimal)currentInterval)) || (autoSync.Checked != (currentInterval != System.Threading.Timeout.Infinite))) { try { ifWebService.SetDefaultSyncInterval(autoSync.Checked ? (int)syncValueInSeconds : System.Threading.Timeout.Infinite); if (autoSync.Checked) { displaySyncInterval((int)syncValueInSeconds); } } catch (Exception ex) { result = false; Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("saveSyncError"), resourceManager.GetString("PreferencesErrorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); mmb.Dispose(); } } } catch (Exception ex) { result = false; Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("readSyncError"), resourceManager.GetString("PreferencesErrorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); mmb.Dispose(); } Cursor.Current = Cursors.Default; return result; }
private void btnOk_Click(object sender, System.EventArgs e) { System.Resources.ResourceManager resManager = new System.Resources.ResourceManager(typeof(Connecting)); if( this.Passphrase.Text == this.RetypePassphrase.Text) { string publicKey = null; string ragent = null; if( this.RecoveryAgentCombo.SelectedItem != null && (string)this.RecoveryAgentCombo.SelectedItem != Resource.GetString("NoneText")) { byte[] CertificateObj = this.simws.GetRACertificateOnClient(this.DomainID, (string)this.RecoveryAgentCombo.SelectedItem); System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(CertificateObj); MyMessageBox mmb = new MyMessageBox( string.Format(resManager.GetString("verifyCert"), (string)this.RecoveryAgentCombo.SelectedItem), resManager.GetString("verifyCertTitle"), cert.ToString(true), MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2); DialogResult messageDialogResult = mmb.ShowDialog(); mmb.Dispose(); mmb.Close(); if( messageDialogResult != DialogResult.Yes ) return; else { ragent = (string)this.RecoveryAgentCombo.SelectedItem; publicKey = Convert.ToBase64String(cert.GetPublicKey()); } } else { MyMessageBox mmb = new MyMessageBox( resManager.GetString("NoCertWarning"), resManager.GetString("NoCertTitle"), "", MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2); DialogResult messageDialogResult = mmb.ShowDialog(); mmb.Dispose(); mmb.Close(); if( messageDialogResult != DialogResult.Yes ) return; } Status passPhraseStatus = null; try { passPhraseStatus = simws.SetPassPhrase( DomainID, this.Passphrase.Text, ragent, publicKey); } catch(Exception ex) { MessageBox.Show( Resource.GetString("IsPassphraseSetException")+ex.Message); } if(passPhraseStatus.statusCode == StatusCodes.Success) { simws.StorePassPhrase( DomainID, this.Passphrase.Text, CredentialType.Basic, this.savePassphrase.Checked); status = true; Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(Resource.GetString("SetPassphraseSuccess"), resourceManager.GetString("$this.Text"), "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Information); mmb.ShowDialog(); mmb.Dispose(); this.Dispose(); this.Close(); } else { status = false; Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(Resource.GetString("IsPassphraseSetException"), resourceManager.GetString("$this.Text"), "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); mmb.Dispose(); } } else { status = false; } }
public void refreshiFolders(string search) { if (search == null) search = ""; search = this.toolStripBtnFilter.Text; Cursor.Current = Cursors.WaitCursor; Hashtable oldHt = new Hashtable(); Hashtable tempHt = new Hashtable(); lock(ht) { foreach ( TileListViewItem tlvi in ht.Values ) { iFolderObject ifolderObject = (iFolderObject)tlvi.Tag; tempHt.Add( ifolderObject.ID, ifolderObject.iFolderState ); } } try { panel2.SuspendLayout(); if (selectedItem != null) updateMenus((iFolderObject)selectedItem.Tag); else updateMenus(null); foreach (iFolderWeb ifolder in ifolderArray) { if( search != null && ((String)ifolder.Name).ToLower().IndexOf(search.ToLower(), 0, ((String)ifolder.Name).Length) < 0) continue; iFolderState state = iFolderState.Normal; if (tempHt.Contains(ifolder.ID)) { state = (iFolderState)tempHt[ifolder.ID]; } else { iFolderObject ifobj = new iFolderObject(ifolder, state); addiFolderToListView(ifobj); ifobj = null; } oldHt.Add(ifolder.ID, state); if (this.acceptedFolders.Contains(ifolder.ID)) { this.acceptedFolders.Remove(ifolder.ID); } } foreach( System.Object obj in this.acceptedFolders.Values) { TileListViewItem tlv = (TileListViewItem)obj; iFolderObject ifobj = (iFolderObject)tlv.Tag; if( search != null && ((String)ifobj.iFolderWeb.Name).ToLower().IndexOf(search.ToLower(), 0, ((String)ifobj.iFolderWeb.Name).Length) < 0) continue; ifobj.iFolderWeb.IsSubscription = false; ifobj.iFolderState = iFolderState.Initial; addiFolderToListView( ifobj ); oldHt.Add(ifobj.ID, ifobj.iFolderState); } string[] ifolders = new string[ht.Count]; ht.Keys.CopyTo(ifolders, 0); foreach (string ifolderid in ifolders) { if (oldHt.ContainsKey(ifolderid) == false) { removeTileListViewItem((TileListViewItem)ht[ifolderid]); } } } catch (Exception ex) { Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(TrayApp.Properties.Resources.iFolderError, TrayApp.Properties.Resources.iFolderErrorTitle, ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Information); mmb.ShowDialog(); mmb.Dispose(); } iFolderView.Items.Sort(); foreach (iFoldersListView ifListView in iFolderListViews.Values) { ifListView.FinalizeUpdate(); } updateView(); panel2.ResumeLayout(); DomainsListUpdate(); DomainsListUpdateComboBox(); inRefresh = false; oldHt = null; Cursor.Current = Cursors.Default; if (!thumbnailView) { showiFolderinListView(); } this.refreshTimer.Start(); }
private void synciFolder(string iFolderID) { try { ifWebService.SynciFolderNow(iFolderID); } catch (Exception ex) { Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(TrayApp.Properties.Resources.syncError, TrayApp.Properties.Resources.syncErrorTitle, ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); mmb.Dispose(); } }
private void menuRevert_Click(object sender, System.EventArgs e) { Cursor.Current = Cursors.WaitCursor; try { iFolderWeb ifolder = ((iFolderObject)selectedItem.Tag).iFolderWeb; bool IsMaster = (ifolder.CurrentUserID == ifolder.OwnerID); IsDomainMaster = IsMaster; RevertiFolder revertiFolder = new RevertiFolder(); if( !IsMaster ) revertiFolder.removeFromServer.Text = TrayApp.Properties.Resources.AlsoRemoveMembership; revertiFolder.removeFromServer.Enabled = simiasWebService.GetDomainInformation(ifolder.DomainID).Authenticated; if ( revertiFolder.ShowDialog() == DialogResult.Yes ) { Invalidate(); Update(); Cursor.Current = Cursors.WaitCursor; if (revertiFolder.RemoveFromServer) ((iFolderObject)selectedItem.Tag).iFolderState = iFolderState.RevertAndDelete; iFolderWeb newiFolder = ifWebService.RevertiFolder(ifolder.ID); Win32Window.ShChangeNotify(Win32Window.SHCNE_UPDATEITEM, Win32Window.SHCNF_PATHW, ifolder.UnManagedPath, IntPtr.Zero); if (newiFolder != null) { acceptedFolders.Remove(newiFolder.ID); if ( revertiFolder.RemoveFromServer ) { selectediFolderID = newiFolder.ID; selectedDomainID = newiFolder.DomainID; Thread revertiFolderThread; revertiFolderThread = new Thread(new ThreadStart(RemoveiFolderFromServer)); revertiFolderThread.Name = "RevertAndDeleteiFolder"; revertiFolderThread.CurrentUICulture = Thread.CurrentThread.CurrentUICulture; revertiFolderThread.IsBackground = true; revertiFolderThread.Priority = ThreadPriority.BelowNormal; revertiFolderThread.Start(); } else { { this.removeTileListViewItem((TileListViewItem)ht[newiFolder.ID]); iFolderObject ifolderobj = new iFolderObject(newiFolder, iFolderState.Normal); addiFolderToListView(ifolderobj); updateView(); } } } } revertiFolder.Dispose(); } catch (Exception ex) { Cursor.Current = Cursors.Default; Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(TrayApp.Properties.Resources.iFolderRevertError, TrayApp.Properties.Resources.revertErrorTitle, ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); mmb.Dispose(); } Cursor.Current = Cursors.Default; }
private void menuRemove_Click(object sender, System.EventArgs e) { if ( selectedItem != null ) { iFolderWeb ifolder = ((iFolderObject)selectedItem.Tag).iFolderWeb; MyMessageBox mmb = null; if( ifolder.CurrentUserID == ifolder.OwnerID) { mmb = new Novell.iFolderCom.MyMessageBox( string.Format( TrayApp.Properties.Resources.deleteiFolder, ifolder.Name ), TrayApp.Properties.Resources.removeTitle, string.Empty, MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2); } else { mmb = new Novell.iFolderCom.MyMessageBox( TrayApp.Properties.Resources.RemoveMembershipMesg, string.Format(TrayApp.Properties.Resources.RemoveMembershipTitle, ifolder.Name ), string.Empty, MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2); } if (mmb.ShowDialog() == DialogResult.Yes) { try { Invalidate(); Update(); if( ifolder.CurrentUserID == ifolder.OwnerID) { ifWebService.DeleteiFolder(ifolder.DomainID, ifolder.ID); } ifWebService.DeclineiFolderInvitation(ifolder.DomainID, ifolder.ID); lock (ht) { removeTileListViewItem( selectedItem ); } } catch (Exception ex) { mmb = new MyMessageBox(TrayApp.Properties.Resources.declineError, TrayApp.Properties.Resources.errorTitle, ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } } mmb.Dispose(); } }
private void menuOpen_Click(object sender, System.EventArgs e) { if ( selectedItem != null ) { iFolderWeb ifolder = ((iFolderObject)selectedItem.Tag).iFolderWeb; try { Process.Start(ifolder.UnManagedPath); } catch (Exception ex) { Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(string.Format(TrayApp.Properties.Resources.iFolderOpenError, ifolder.Name), TrayApp.Properties.Resources.openErrorTitle, ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); mmb.Dispose(); } } }
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(); } }
private void apply_Click(object sender, System.EventArgs e) { this.processChanges(); try { connectToWebService(); string id = currentiFolder.ID; currentiFolder = null; currentiFolder = ifWebService.GetiFolder(id); } catch (Exception ex) { MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("iFolderReadError"), resourceManager.GetString("errorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } }
private void add_Click(object sender, System.EventArgs e) { bool SharingIsDisabled = ifWebService.GetDisableSharingPolicy(currentUser.UserID, currentiFolder.ID, currentiFolder.OwnerID, currentiFolder.DomainID); if( SharingIsDisabled == true) { Picker picker = new Picker(); picker.LoadPath = loadPath; picker.iFolderWebService = ifWebService; picker.Ht = userIDHT; picker.CurrentUser = currentUser; picker.DomainID = currentiFolder.DomainID; if (ownerLvi != null) { picker.CurrentOwner = newOwnerLvi == null ? ((ShareListMember)ownerLvi.Tag).iFolderUser : ((ShareListMember)newOwnerLvi.Tag).iFolderUser; } picker.CreateControl(); DialogResult result = picker.ShowDialog(); if (result == DialogResult.OK) { Cursor.Current = Cursors.WaitCursor; shareWith.SelectedItems.Clear(); apply.Enabled = true; foreach (ListViewItem lvi in picker.AddedUsers) { iFolderUser user = picker.GetiFolderUserFromListViewItem(lvi); ListViewItem lvitem; lock (userIDHT) { lvitem = (ListViewItem)userIDHT[user.UserID]; } if (lvitem == null) { user.Rights = "ReadOnly"; user.State = inviting; addiFolderUserToListView(user); } } foreach (iFolderUser ifUser in picker.RemovedList) { lock (subscrHT) { ListViewItem lvi = (ListViewItem)subscrHT[ifUser.ID]; if (lvi != null) { if (removedList == null) { removedList = new ArrayList(); } removedList.Add(lvi.Tag); lvi.Remove(); subscrHT.Remove(ifUser.ID); } else { lock (userIDHT) { lvi = (ListViewItem)userIDHT[ifUser.UserID]; if (lvi != null) { lvi.Remove(); } } } } lock (userIDHT) { userIDHT.Remove(ifUser.UserID); } } Cursor.Current = Cursors.Default; } } else { MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("DisableSharingError"), resourceManager.GetString("PolicyViolation"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Information); mmb.ShowDialog(); } }
private void updateDiskQuotaDisplay() { try { connectToWebService(); DiskSpace diskSpace = ifWebService.GetiFolderDiskSpace(currentiFolder.ID); double usedSpace = Math.Round(diskSpace.UsedSpace/megaByte, 2); used.Text = usedSpace.ToString(); if (diskSpace.Limit != 0) { limitEdit.Text = limit.Text = ((double)Math.Round(diskSpace.Limit/megaByte, 2)).ToString(); setLimit.Checked = true; available.Text = ((double)Math.Round(diskSpace.AvailableSpace/megaByte, 2)).ToString(); gaugeChart.MaxValue = diskSpace.Limit / megaByte; gaugeChart.Used = usedSpace; gaugeChart.BarColor = SystemColors.ActiveCaption; } else { setLimit.Checked = false; available.Text = limit.Text = limitEdit.Text = ""; gaugeChart.Used = 0; } } catch (Exception ex) { MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("diskQuotaReadError"), resourceManager.GetString("errorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); setLimit.Checked = false; used.Text = available.Text = limit.Text = ""; gaugeChart.Used = 0; } gaugeChart.Invalidate(true); }
private void syncNow_Click(object sender, System.EventArgs e) { try { ifWebService.SynciFolderNow(currentiFolder.ID); } catch (Exception ex) { MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("syncError"), string.Empty, ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } }
private void menuRecoverKeys_Click(object sender, EventArgs e) { KeyRecoveryWizard kr = new KeyRecoveryWizard(this.ifWebService, this.simiasWebService, this.simiasManager); if (kr.GetLoggedInDomains() == true) { kr.ShowDialog(); } else { System.Resources.ResourceManager Resource = new System.Resources.ResourceManager(typeof(FormsTrayApp)); Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(Resource.GetString("NoLoggedInDomainsText"), Resource.GetString("ResetError"), "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); mmb.Dispose(); } }
private bool Export_func() { try { GetDefaultPath(selectedDomain.Name); this.simiasWebService.ExportiFoldersCryptoKeys(selectedDomain.ID, inputFilePath); } catch (Exception ex) { MyMessageBox mmb = new MyMessageBox(TrayApp.Properties.Resources.unableToExportMesg, TrayApp.Properties.Resources.wizardText, null, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); return false; } return true; }
void menuResetPassword_Click(object sender, EventArgs e) { ResetPassword resetPasswordWindow = new ResetPassword(this.simiasWebService, this.ifWebService); if (resetPasswordWindow.DomainCount > 0) resetPasswordWindow.ShowDialog(); else { System.Resources.ResourceManager Resource = new System.Resources.ResourceManager(typeof(FormsTrayApp)); Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(Resource.GetString("NoLoggedInDomainsPasswordText"), Resource.GetString("ResetPasswordError"), "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); mmb.Dispose(); } }
private bool Import_func() { try { string onetimepp = null; this.simiasWebService.ImportiFoldersCryptoKeys(selectedDomain.ID, this.newPassphrase.Text, onetimepp, this.outputFilePath); bool rememberOption = this.simiasWebService.GetRememberOption(selectedDomain.ID); this.simiasWebService.StorePassPhrase(selectedDomain.ID, "", CredentialType.None, false); this.simiasWebService.StorePassPhrase(selectedDomain.ID, this.newPassphrase.Text, CredentialType.Basic, rememberOption); } catch (Exception ex) { MyMessageBox mmb = new MyMessageBox(TrayApp.Properties.Resources.importErrorMesg, TrayApp.Properties.Resources.wizardText, null, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); return false; } return true; }
private void menuShare_Click(object sender, System.EventArgs e) { TileListViewItem selected = (TileListViewItem)selectedItem; iFolderWeb curriFolder = ((iFolderObject)selected.Tag).iFolderWeb; if (curriFolder.encryptionAlgorithm != null && curriFolder.encryptionAlgorithm != "") { MyMessageBox cannotShareDialog = new MyMessageBox(TrayApp.Properties.Resources.cannotShareMessage, TrayApp.Properties.Resources.cannotShareTitle, string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Warning); cannotShareDialog.ShowDialog(); } else { invokeiFolderProperties( selectedItem, 1 ); } }
private void btnReset_Click(object sender, System.EventArgs e) { string title; string message; System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ResetPassword)); if( this.newPassword.Text != this.confirmPassword.Text ) { title = resources.GetString("Errorchangingpassword"); message = resources.GetString("PasswordsDoesNotMatch"); MyMessageBox mb1 = new MyMessageBox(message, title, "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mb1.ShowDialog(); mb1.Dispose(); this.success = false; return; } else if (this.newPassword.Text == this.oldpassword.Text) { title = resources.GetString("Errorchangingpassword"); message = resources.GetString("PasswordsSame"); MyMessageBox mb1 = new MyMessageBox(message, title, "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mb1.ShowDialog(); mb1.Dispose(); this.success = false; return; } try { DomainItem domainItem = (DomainItem)this.DomainComboBox.SelectedItem; this.domainID = domainItem.ID; System.Resources.ResourceManager resManager = new System.Resources.ResourceManager(typeof(Connecting)); this.PerformResetPassword(this.domainID, this.oldpassword.Text, this.newPassword.Text); } catch(Exception ex) { MessageBox.Show(Resource.GetString("ResetError") , Resource.GetString("ResetTitle") ); this.success = false; } }
public bool AcceptiFolder(iFolderWeb ifolder, out bool added, bool mergeFolder) { bool result = false; added = false; if (ifolder.MigratediFolder > 0) { if (MigrationWindow.OldiFoldersPresent() == true) { System.Resources.ResourceManager resManager = new System.Resources.ResourceManager(typeof(FormsTrayApp)); MyMessageBox mmb = new MyMessageBox(resManager.GetString("MigrationMergePrompt.Text"), resManager.GetString("MigrationAlert"), "", MyMessageBoxButtons.OKCancel, MyMessageBoxIcon.Question); DialogResult res = mmb.ShowDialog(); if (res == DialogResult.OK) { Novell.FormsTrayApp.MigrationWindow migrationWindow = new MigrationWindow(this.ifWebService, this.simiasWebService); migrationWindow.Merge = true; migrationWindow.iFolderName = ifolder.Name; migrationWindow.ShowDialog(); string loc = migrationWindow.iFolderLocation; string uName = migrationWindow.UserName; if (loc == null || uName == null) { return false; } else { result = acceptiFolder(ifolder, loc, out added, true); if (result == true) { MigrationWindow.RemoveRegistryForUser(uName); } } return result; } } } string selectedPath = string.Empty; FolderBrowserDialog browserDialog = new FolderBrowserDialog(); Cursor.Current = Cursors.WaitCursor; while (true) { browserDialog.ShowNewFolderButton = true; browserDialog.SelectedPath = selectedPath; if (!mergeFolder) { browserDialog.Description = string.Format(TrayApp.Properties.Resources.acceptDescription, ifolder.Name); } else { browserDialog.Description = string.Format(TrayApp.Properties.Resources.mergeDescription, ifolder.Name); } DialogResult dialogResult = browserDialog.ShowDialog(); if ( dialogResult == DialogResult.OK ) { browserDialog.Dispose(); Invalidate(); Update(); result = acceptiFolder(ifolder, browserDialog.SelectedPath, out added, mergeFolder); if (result && !added) { break; } else if ( result ) { if (!mergeFolder) DownloadPath = browserDialog.SelectedPath + ifolder.Name; else DownloadPath = browserDialog.SelectedPath; break; } } else { browserDialog.Dispose(); break; } } Cursor.Current = Cursors.Default; refreshAll(); return result; }
private void PerformResetPassword(string domainid, string oldpassword, string newpassword) { string title = null; string message = null; System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ResetPassword)); int result = this.ifws.ChangePassword(domainid, oldpassword, newpassword); if (result == 0) { try { if (this.rememberPassword.Checked == true) { this.simiasWebservice.SetDomainCredentials(domainid, newpassword, CredentialType.Basic); } else { this.simiasWebservice.SetDomainCredentials(domainid, null, CredentialType.None); } } catch { } title = resources.GetString("ResetPasswordTitle"); message = resources.GetString("Resetpasswordsuccess"); MyMessageBox mb = new MyMessageBox(message, title, "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Information); mb.ShowDialog(); mb.Dispose(); this.success = true; this.Dispose(); this.Close(); return; } title = resources.GetString("Errorchangingpassword"); switch (result) { case 1: message = resources.GetString("IncorrectOldPassword"); break; case 2: message = resources.GetString("Failedtoresetpassword"); break; case 3: message = resources.GetString("LoginDisabled"); break; case 4: message = resources.GetString("Useraccountexpired"); break; case 5: message = resources.GetString("Usercannotchangepassword"); break; case 6: message = resources.GetString("Userpasswordexpired"); break; case 7: message = resources.GetString("Minimumpasswordlengthrestrictionnotmet"); break; case 8: message = resources.GetString("Usernotfoundinsimias"); break; default: message = resources.GetString("Errorchangingpassword"); break; } message = resources.GetString("Couldnotchangepassword") + message; MyMessageBox mb1 = new MyMessageBox(message, title, "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mb1.ShowDialog(); mb1.Dispose(); this.success = false; }
private bool acceptiFolder(iFolderWeb ifolder, string path, out bool added, bool mergeFolder) { bool download = false; bool result = true; bool repeatFlag = false; added = true; if (GetDriveType(Path.GetPathRoot(path)) == DRIVE_FIXED) { if (Win32Security.AccessAllowed(path)) { try { if (ifolder.encryptionAlgorithm == null || ifolder.encryptionAlgorithm == "") { download = true; } else { string passphrasecheck = null; passphrasecheck = simiasWebService.GetPassPhrase(ifolder.DomainID); if (passphrasecheck == null || passphrasecheck == "") { VerifyPassphraseDialog vpd = new VerifyPassphraseDialog(ifolder.DomainID, simiasWebService); vpd.ShowDialog(); download = vpd.PassphraseStatus; } else { download = true; } } if (download) { Cursor = Cursors.WaitCursor; if (mergeFolder == true) { string mergediFolder = path; if(System.IO.Path.GetFileName(mergediFolder) != ifolder.Name) { throw new Exception("FolderDoesNotExist"); } if (Directory.Exists(mergediFolder) == false) { throw new Exception("PathDoesNotExist"); } if (ifWebService.IsiFolder(mergediFolder) == true) { throw new Exception("AtOrInsideCollectionPath"); } ifWebService.MergeiFolder(ifolder.DomainID, ifolder.ID, mergediFolder); Cursor = Cursors.Default; } else { DirectoryInfo di = new DirectoryInfo(path); if (di.Name == ifolder.Name) { path = Directory.GetParent(path).ToString(); } if( System.IO.Directory.Exists( Path.Combine(path,ifolder.Name)) ) { MyMessageBox mmb = new MyMessageBox(Resources.OkMergeCancel,Resources.Folderexists, String.Empty, MyMessageBoxButtons.OKCancel, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button1); if (mmb.ShowDialog() == DialogResult.OK) { ifWebService.MergeiFolder(ifolder.DomainID, ifolder.ID, Path.Combine(path, ifolder.Name)); } else return false; } else ifWebService.AcceptiFolderInvitation(ifolder.DomainID, ifolder.ID, path); Cursor = Cursors.Default; } } else { result = true; added = false; } } catch (Exception ex) { Cursor = Cursors.Default; added = false; MyMessageBox mmb; if (ex.Message.IndexOf("260") != -1) { mmb = new MyMessageBox("The iFolder path is too long for the File System. Download failed", "Path Too Long", string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); repeatFlag = true; } else if (ex.Message.IndexOf("PathExists") != -1) { mmb = new MyMessageBox(TrayApp.Properties.Resources.pathExistsError, TrayApp.Properties.Resources.pathInvalidErrorTitle, string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } else if (ex.Message.IndexOf("AtOrInsideStorePath") != -1) { mmb = new MyMessageBox(TrayApp.Properties.Resources.pathInStoreError, TrayApp.Properties.Resources.pathInvalidErrorTitle, string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } else if (ex.Message.IndexOf("AtOrInsideCollectionPath") != -1) { mmb = new MyMessageBox(TrayApp.Properties.Resources.pathIniFolderError, TrayApp.Properties.Resources.pathInvalidErrorTitle, string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } else if (ex.Message.IndexOf("IncludesWinDirPath") != -1) { mmb = new MyMessageBox(TrayApp.Properties.Resources.pathIncludesWinDirError, TrayApp.Properties.Resources.pathInvalidErrorTitle, string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } else if (ex.Message.IndexOf("IncludesProgFilesPath") != -1) { mmb = new MyMessageBox(TrayApp.Properties.Resources.PathIncludesProgFilesDirError, TrayApp.Properties.Resources.pathInvalidErrorTitle, string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } else if (ex.Message.IndexOf("PathDoesNotExist") != -1) { mmb = new MyMessageBox(TrayApp.Properties.Resources.PathDoesNotExist, TrayApp.Properties.Resources.pathInvalidErrorTitle, ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } else if (ex.Message.IndexOf("FolderDoesNotExist") != -1) { mmb = new MyMessageBox(TrayApp.Properties.Resources.FolderDoesNotExistError, TrayApp.Properties.Resources.FolderDoesNotExistErrorTitle, TrayApp.Properties.Resources.FolderDoesNotExistErrorDesc, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } else { mmb = new MyMessageBox(TrayApp.Properties.Resources.acceptError, string.Empty, ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } if (!repeatFlag) result = false; } } else { result = false; MyMessageBox mmb = new MyMessageBox(TrayApp.Properties.Resources.accessDenied, string.Empty, string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); } } else { MessageBox.Show(TrayApp.Properties.Resources.networkPath, TrayApp.Properties.Resources.pathInvalidErrorTitle); result = false; } return result; }
private void btnReset_Click(object sender, System.EventArgs e) { try { DomainItem domainItem = (DomainItem)this.DomainComboBox.SelectedItem; this.domainID = domainItem.ID; System.Resources.ResourceManager resManager = new System.Resources.ResourceManager(typeof(Connecting)); string publicKey = null; string ragent = null; Status status = null; try { status = simws.ValidatePassPhrase(this.domainID, this.passPhrase.Text); if(status.statusCode == StatusCodes.PassPhraseInvalid) { status = simws.ValidatePassPhrase(this.domainID, this.newPassphrase.Text); } } catch (Exception ex) { System.Resources.ResourceManager resMgr = new System.Resources.ResourceManager(typeof(VerifyPassphraseDialog)); MessageBox.Show(resMgr.GetString("ValidatePPError"), ex.Message); } if (status.statusCode == StatusCodes.PassPhraseInvalid) { MessageBox.Show(Resource.GetString("InvalidCurrentPPText") , Resource.GetString("ResetTitle") ); this.success = false; return; } if (this.recoveryAgentCombo.SelectedItem != null && (string)this.recoveryAgentCombo.SelectedItem != TrayApp.Properties.Resources.serverDefaultRA) { byte[] CertificateObj = this.simws.GetRACertificateOnClient(this.DomainID, (string)this.recoveryAgentCombo.SelectedItem); System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(CertificateObj); MyMessageBox mmb = new MyMessageBox(string.Format(resManager.GetString("verifyCert"), (string)this.recoveryAgentCombo.SelectedItem), resManager.GetString("verifyCertTitle"), cert.ToString(true), MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button2); DialogResult messageDialogResult = mmb.ShowDialog(); mmb.Dispose(); mmb.Close(); if (messageDialogResult != DialogResult.Yes) return; else { ragent = (string)this.recoveryAgentCombo.SelectedItem; publicKey = Convert.ToBase64String(cert.GetPublicKey()); } } else { ragent = "DEFAULT"; DomainInformation domainInfo = (DomainInformation)this.simws.GetDomainInformation(this.DomainID); string memberUID = domainInfo.MemberUserID; publicKey = this.ifws.GetDefaultServerPublicKey(this.DomainID, memberUID); } status = this.simws.ReSetPassPhrase(this.DomainID, this.passPhrase.Text , this.newPassphrase.Text, ragent, publicKey); if( status.statusCode == StatusCodes.Success) { simws.StorePassPhrase(this.DomainID, "", CredentialType.None, false); simws.StorePassPhrase(this.DomainID, this.newPassphrase.Text, CredentialType.Basic, this.rememberPassphrase.Checked); MyMessageBox mb = new MyMessageBox(string.Format(Resource.GetString("ResetSuccess")), Resource.GetString("ResetTitle"), "", MyMessageBoxButtons.OK, MyMessageBoxIcon.Information); mb.ShowDialog(); mb.Dispose(); this.success = true; this.Dispose(); this.Close(); } else { MessageBox.Show(Resource.GetString("ResetError") , Resource.GetString("ResetTitle") ); this.success = false; } } catch(Exception ex) { MessageBox.Show(Resource.GetString("ResetError") , Resource.GetString(ex.Message) ); this.success = false; } }
private void Preferences_VisibleChanged(object sender, System.EventArgs e) { if (this.Visible) { accounts.Items.Clear(); successful = true; DomainInformation[] domains; try { domains = simiasWebService.GetDomains(true); foreach (DomainInformation di in domains) { AddDomainToList(di); } } catch (Exception ex) { Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("readAccountsError"), resourceManager.GetString("accountErrorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); mmb.Dispose(); } apply.Enabled = false; autoStart.Checked = IsRunEnabled(); notifyShared.Checked = NotifyShareEnabled; notifyCollisions.Checked = NotifyCollisionEnabled; notifyJoins.Checked = NotifyJoinEnabled; startInTrayIcon.Checked = HideiFolderInTray; hideSyncLog.Checked = HideSyncLogWindow; hidenotification.Checked = HidePolicyVoilationNotification; displayConfirmation.Checked = iFolderComponent.DisplayConfirmationEnabled; displayTrayIcon.Checked = !(iFolderComponent.DisplayTrayIconEnabled); notifyCheckbox.Checked = false; policylistbox.ClearSelected(); if (NotifyPolicyQouta) policylistbox.SelectedIndex = (int)policyVoilation.QuotaVoliation; if (NotifyPolicySize) policylistbox.SelectedIndex = (int)policyVoilation.FileSizeVoilation; if (NotifyPolicyType) policylistbox.SelectedIndex = (int)policyVoilation.FileTypeVoilation; if (NotifyPathLong) policylistbox.SelectedIndex = (int)policyVoilation.LongPath; if (NotifyIOPermission) policylistbox.SelectedIndex = (int)policyVoilation.PremissionUnavailable; if (NotifyDiskFull) policylistbox.SelectedIndex = (int)policyVoilation.DiskFullVoilation; try { int syncInterval = ifWebService.GetDefaultSyncInterval(); minimumSeconds = (!syncInterval.Equals(System.Threading.Timeout.Infinite) && (syncInterval < (int)defaultMinimumSeconds)) ? (decimal)syncInterval : defaultMinimumSeconds; displaySyncInterval(syncInterval); } catch (Exception ex) { Novell.iFolderCom.MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("readSyncError"), resourceManager.GetString("PreferencesErrorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); mmb.Dispose(); } Activate(); } }
internal override int ValidatePage(int currentIndex) { bool status = false; System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager(typeof(CreateiFolder)); if( this.CreateDefault.Checked == false) status = true; else if( upload ) { if (ifws.GetLimitPolicyStatus(domainInfo.ID) == 1) { iFolderWeb ifolder = null; ifolder = CreateDefaultiFolder(this.sslCheckButton.Checked); if (ifolder != null) { status = true; this.simws.DefaultAccount(domainInfo.ID, ifolder.ID); } } else { MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("ifolderlimiterror"), resourceManager.GetString("errorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); status = true; } } else { iFolderWeb ifolder= this.ifws.GetMinimaliFolder( this.defaultiFolderID, 1 ); if( ifolder != null) { status = DownloadiFolder(ifolder); } else { status = false; } } if( status == true) return base.ValidatePage (currentIndex); else return currentIndex; }
private void removeAccount_Click(object sender, System.EventArgs e) { ListViewItem lvi = accounts.SelectedItems[0]; Domain domain = (Domain)lvi.Tag; if (domain == null) { newAccountLvi = null; lvi.Remove(); updatePassword = updateEnabled = updateHost = false; addAccount.Enabled = true; } else { RemoveAccount removeAccount = new RemoveAccount(domain.DomainInfo); if (removeAccount.ShowDialog() == DialogResult.Yes) { try { simiasWebService.LeaveDomain(domain.ID, !removeAccount.RemoveAll); lvi.Remove(); string defaultDomainID = null; if (domain.Equals(currentDefaultDomain)) { defaultDomainID = simiasWebService.GetDefaultDomainID(); } if (RemoveDomain != null) { RemoveDomain(this, new DomainRemoveEventArgs(domain.DomainInfo, defaultDomainID)); } if (defaultDomainID != null) { foreach (ListViewItem item in accounts.Items) { Domain d = (Domain)item.Tag; if (d.ID.Equals(defaultDomainID)) { currentDefaultDomain = d; break; } } } updatePassword = updateEnabled = updateHost = false; } catch (Exception ex) { MyMessageBox mmb = new MyMessageBox(resourceManager.GetString("removeAccountError"), resourceManager.GetString("accountErrorTitle"), ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); mmb.Dispose(); } } DomainInformation[] domains; System.Threading.Thread.Sleep(2000); domains = this.simiasWebService.GetDomains(false); if (domains.Length.Equals(0)) { if (((GlobalProperties)FormsTrayApp.globalProp()).Visible) ((GlobalProperties)FormsTrayApp.globalProp()).Hide(); } removeAccount.Dispose(); } }
private void DisplayErrorMesg( Exception ex) { MyMessageBox mmb; string message; System.Resources.ResourceManager resourceManager =new System.Resources.ResourceManager(typeof(CreateiFolder)); System.Resources.ResourceManager resourcemanager = new System.Resources.ResourceManager(typeof(GlobalProperties)); string caption = resourceManager.GetString("pathInvalidErrorTitle"); if (ex.Message.IndexOf("InvalidCharactersPath") != -1) { message = resourceManager.GetString("invalidCharsError"); } else if (ex.Message.IndexOf("AtOrInsideStorePath") != -1) { message = resourceManager.GetString("pathInStoreError"); } else if (ex.Message.IndexOf("ContainsStorePath") != -1) { message = resourceManager.GetString("pathContainsStoreError"); } else if (ex.Message.IndexOf("SystemDirectoryPath") != -1) { message = resourceManager.GetString("systemDirError"); } else if (ex.Message.IndexOf("SystemDrivePath") != -1) { message = resourceManager.GetString("systemDriveError"); } else if (ex.Message.IndexOf("IncludesWinDirPath") != -1) { message = resourceManager.GetString("winDirError"); } else if (ex.Message.IndexOf("IncludesProgFilesPath") != -1) { message = resourceManager.GetString("progFilesDirError"); } else if (ex.Message.IndexOf("ContainsCollectionPath") != -1) { message = resourceManager.GetString("containsiFolderError"); } else if (ex.Message.IndexOf("AtOrInsideCollectionPath") != -1) { message = resourceManager.GetString("pathIniFolderError"); } else if (ex.Message.IndexOf("RootOfDrivePath") != -1) { message = resourceManager.GetString("rootDriveError"); } else if (ex.Message.IndexOf("NotFixedDrivePath") != -1) { message = resourceManager.GetString("networkPathError"); } else if (ex.Message.IndexOf("PathExists") != -1) { message = resourcemanager.GetString("pathExistsError"); } else if( this.upload == true) { message = resourceManager.GetString("iFolderCreateError"); caption = resourceManager.GetString("errorTitle"); } else { message = resourceManager.GetString("acceptError"); caption = resourceManager.GetString("errorTitle"); } mmb = new MyMessageBox(message, caption, string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error); mmb.ShowDialog(); }
public static bool CheckForClientUpdate(string domainID) { bool updateStarted = false; string version = instance.ifWebService.CheckForUpdatedClient(domainID); if ( version != null ) { MyMessageBox mmb = new MyMessageBox(string.Format(resourceManager.GetString("clientUpgradePrompt"), version), resourceManager.GetString("clientUpgradeTitle"), string.Empty, MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question); DialogResult result = mmb.ShowDialog(); if ( result == DialogResult.Yes ) { if ( updateStarted == false ) { mmb = new MyMessageBox(resourceManager.GetString("clientUpgradeFailure"), resourceManager.GetString("upgradeErrorTitle"), string.Empty, MyMessageBoxButtons.OK, MyMessageBoxIcon.Information); mmb.ShowDialog(); } } } return updateStarted; }
private bool DownloadiFolder(iFolderWeb defaultiFolder) { bool status = false; if (defaultiFolder.encryptionAlgorithm == null || defaultiFolder.encryptionAlgorithm == "") { status = true; } else { string passphrasecheck = null; passphrasecheck = simws.GetPassPhrase(domainInfo.ID); if (passphrasecheck == null || passphrasecheck == "") { VerifyPassphraseDialog vpd = new VerifyPassphraseDialog(domainInfo.ID, this.simws); vpd.ShowDialog(); status = vpd.PassphraseStatus; } else { status = true; } } if (status == true) { try { string downloadpath = this.LocationEntry.Text; DirectoryInfo di = new DirectoryInfo(downloadpath); if (di.Name == defaultiFolder.Name) { downloadpath = Directory.GetParent(this.LocationEntry.Text).ToString(); di = new DirectoryInfo(downloadpath); } di.Create(); iFolderWeb ifolder = null; if (System.IO.Directory.Exists(Path.Combine(downloadpath, defaultiFolder.Name))) { MyMessageBox mmb = new MyMessageBox(resManager.GetString("selectoption"), resManager.GetString("alreadyexists"), String.Empty, MyMessageBoxButtons.OKCancel, MyMessageBoxIcon.Question, MyMessageBoxDefaultButton.Button1); if (mmb.ShowDialog() == DialogResult.OK) { ifolder = this.ifws.MergeiFolder(defaultiFolder.DomainID, defaultiFolder.ID, Path.Combine(downloadpath, defaultiFolder.Name)); } else return false; } else ifolder = this.ifws.AcceptiFolderInvitation(defaultiFolder.DomainID, defaultiFolder.ID, downloadpath); AccountWizard wiz = (AccountWizard)this.Parent; if (ifolder != null && wiz != null) { wiz.GlobalProps.AddiFolderToAcceptediFolders(ifolder, null, downloadpath); } wiz.UpdateDisplay(ifolder, Path.Combine(downloadpath, ifolder.Name)); } catch (Exception ex) { DisplayErrorMesg(ex); return false; } return true; } else return status; }