Esempio n. 1
0
        private void ResetViews()
        {
            if (MainOutlineView != null)
            {
                MainOutlineView.DataSource = null;
                if (outlineViewDataSource.RootNode.Children != null)
                {
                    outlineViewDataSource.RootNode.Children.Clear();
                }
                outlineViewDataSource = null;

                MainOutlineView.OutlineTableColumn.HeaderCell.Title = string.Empty;
            }
            if (MainTableView != null)
            {
                RemoveTableColumns();
                MainTableView.DataSource = null;
            }
            Window.Title            = "Lightwave Directory";
            StatusLabel.StringValue = "Logged in : none";

            NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadOutlineView", this);
            NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadTableView", this);
            SetToolBarState(false);
        }
        private void CloseConnection()
        {
            try
            {
                //Todo - replace isClosed value with VmAfdCloseServer return value. Need to add the Api in interop.
                bool isClosed = true;
                if (isClosed)
                {
                    Servernode.IsLoggedIn = false;
                    outlineViewDataSource.RootNode.Children.Clear();
                    outlineViewDataSource = null;
                    splitViewController.MainOutlineView.DataSource = null;
                    splitViewController.MainTableView.DataSource   = null;
                    this.LoggedInLabel.StringValue = "";
                    splitViewController.MainOutlineView.OutlineTableColumn.HeaderCell.Title = "";
                    RemoveTableColumns();

                    NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadOutlineView", this);
                    NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadTableView", this);
                    SetToolBarState(false);
                }
            }
            catch (Exception ex)
            {
                UIErrorHelper.ShowAlert("", ex.Message);
            }
        }
Esempio n. 3
0
        private void InitialiseViews()
        {
            AppDelegate appDelegate = NSApplication.SharedApplication.Delegate  as AppDelegate;

            appDelegate.OpenConnectionMenuITem.Hidden = true;
            try
            {
                if (serverNode.IsLoggedIn)
                {
                    InitialiseDefaultOutlineView();
                    VMDirSnapInEnvironment.Instance.LocalData.AddServer(serverNode.DTO.Server);
                    DirectoryNode baseNode = new DirectoryNode(serverNode.DTO.BaseDN, serverNode.DTO, null);
                    baseNode.IsBaseNode   = true;
                    outlineViewDataSource = new OutlineViewDataSource(baseNode);
                    splitViewController.MainOutlineView.DataSource = outlineViewDataSource;
                    baseNode.PopulateChildren(serverNode.DTO.BaseDN);
                    SetToolBarState(true);
                    InitialiseDefaultTableView();
                    StatusLabel.StringValue = "Logged in : " + serverNode.DTO.BindDN;
                }
                else
                {
                    UIErrorHelper.ShowAlert("Please check your server details and credentials.", "Login not successful!");
                }
            }
            catch (Exception e)
            {
                CloseConnection();
                UIErrorHelper.ShowAlert(e.Message, "Error in populating the directory. Please check the login details and try again");
            }
        }
        public void InitialiseViews()
        {
            try
            {
                Servernode.IsLoggedIn = true;
                AppDelegate appDelegate = NSApplication.SharedApplication.Delegate as AppDelegate;
                appDelegate.OpenConnectionMenuItem.Hidden = true;

                //assign datasources and prepare TableView and OutlineView
                outlineViewDataSource = new OutlineViewDataSource(new VecsStoresNode(Servernode));
                splitViewController.MainOutlineView.DataSource                  = outlineViewDataSource;
                splitViewController.MainOutlineView.Activated                  += OnOutlineViewActivated;
                splitViewController.MainOutlineView.SelectionDidChange         += OnOutlineViewActivated;
                splitViewController.MainOutlineView.OutlineTableColumn.DataCell = new NSBrowserCell();
                this.LoggedInLabel.StringValue = "Logged in : " + Servernode.ServerDTO.UserName;
                splitViewController.MainOutlineView.OutlineTableColumn.HeaderCell.Title = "Connected to " + Servernode.ServerDTO.Server;

                SetToolBarState(true);

                VMCertStoreSnapInEnvironment.Instance.LocalData.AddServer(Servernode.ServerDTO.Server);

                //Assign delegates
                splitViewController.MainOutlineView.Delegate = new OutlineDelegate(this);
                splitViewController.MainTableView.Delegate   = new TableDelegate(this);
            }
            catch (Exception e)
            {
                UIErrorHelper.ShowAlert(e.Message, "Alert");
            }
        }
        /// <inheritdoc />
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();
            DropFilesHereText.AlphaValue = 0.25f;
            View.Controller       = this;
            View.PropertyChanged += HandleDataContextChanged;
            this.SetValue(MenuLayoutCommandGroup.NewDirectoryCommand.UniqueId, NewFolderButton);
            this.SetValue(MenuLayoutCommandGroup.DeleteItemsCommand.UniqueId, RemoveItemButton);
            this.SetValue(MenuLayoutCommandGroup.SetColorCommand.UniqueId, ItemColorWell);
            this.InitializeCommandsInAwakeFromNib();
            var outlineView = View.FindChild <MenuOutlineView>();

            TheDelegate            = new OutlineViewDelegate(MenuLayoutController, LtoFlashViewModel);
            TheDataSource          = new OutlineViewDataSource(MenuLayoutController);
            outlineView.Controller = this;
            outlineView.Delegate   = TheDelegate;
            outlineView.DataSource = TheDataSource;
            outlineView.RegisterForDraggedTypes(new string[] { MenuLayoutViewModel.DragDataFormat, ProgramDescriptionViewModel.DragDataFormat });
            outlineView.SetDraggingSourceOperationMask(NSDragOperation.Move, true);

            DeviceCommandGroup.Group.InitializeConnectionMenu(LtoFlashViewModel);

            PowerStateIcon.Image       = typeof(CommandGroup).LoadImageResource("ViewModel/Resources/Images/console_16xLG.png");
            PowerStateIcon.ToolTip     = LtoFlashViewModel.ActiveLtoFlashDevice.PowerState;
            PowerStateIcon.Enabled     = LtoFlashViewModel.ActiveLtoFlashDevice.IsValid && LtoFlashViewModel.ActiveLtoFlashDevice.Device.HardwareStatus.HasFlag(HardwareStatusFlags.ConsolePowerOn);
            ConnectionIcon.Image       = this.LoadImageResource("Resources/Images/connected_16x16.png");
            ConnectionIcon.ToolTip     = LtoFlashViewModel.ActiveLtoFlashDevice.DisplayName;
            ConnectionIcon.Enabled     = LtoFlashViewModel.ActiveLtoFlashDevice.IsValid;
            MenuDifferencesIcon.Hidden = !LtoFlashViewModel.ShowFileSystemsDifferIcon;
            MenuDifferencesIcon.Image  = this.LoadImageResource("Resources/Images/lto_flash_contents_not_in_sync_16xLG.png");
        }
        private void ResetMainWindow()
        {
            serverNode.IsLoggedIn = false;
            if (outlineViewDataSource != null)
            {
                outlineViewDataSource.RootNode.Children.Clear();
                outlineViewDataSource = null;
            }
            splitViewController.MainOutlineView.DataSource = null;
            splitViewController.MainOutlineView.OutlineTableColumn.HeaderCell.Title = string.Empty;

            splitViewController.MainTableView.DataSource = null;
            RemoveTableColumns();
            LoggedInLabel.StringValue = string.Empty;
            SetToolBarState(false);
        }
        public void InitialiseViews()
        {
            try
            {
                if (serverNode.IsLoggedIn == true)
                {
                    SetToolBarState(true);
                    //AppDelegate appDelegate = NSApplication.SharedApplication.Delegate as AppDelegate;
                    //appDelegate.OpenConnectionMenuItem.Hidden = true;

                    //assign datasources and prepare TableView and OutlineView
                    rootNode = new VMDirSchemaRootScopeNode(serverNode);
                    outlineViewDataSource = new OutlineViewDataSource(rootNode);
                    rootNode.AddChildren();
                    splitViewController.MainOutlineView.DataSource                  = outlineViewDataSource;
                    splitViewController.MainOutlineView.Activated                  += OnOutlineViewActivated;
                    splitViewController.MainOutlineView.SelectionDidChange         += OnOutlineViewActivated;
                    splitViewController.MainOutlineView.OutlineTableColumn.DataCell = new NSBrowserCell();

                    splitViewController.MainTableView.DoubleClick   += OnDoubleClickedTableView;
                    splitViewController.MainOutlineView.DoubleClick += OnDoubleClickedOutlineView;

                    this.LoggedInLabel.StringValue = VMIdentityConstants.LOGGED_IN + serverNode.ServerDTO.BindDN;
                    this.Window.Title = VMDirSchemaConstants.VMDIRSCHEMA_APPNAME;

                    VMDirSchemaSnapInEnvironment.Instance.LocalData.AddServer(serverNode.ServerDTO.Server);

                    splitViewController.MainOutlineView.OutlineTableColumn.HeaderCell.Title = VMIdentityConstants.CONNECT_TO + serverNode.DisplayName;


                    VMDirSchemaSnapInEnvironment.Instance.LocalData.AddServer(serverNode.ServerDTO.Server);

                    //Assign delegates
                    splitViewController.MainOutlineView.Delegate = new OutlineDelegate(this);
                    splitViewController.MainTableView.Delegate   = new TableDelegate(this);
                }
                else
                {
                    throw new Exception(VMIdentityConstants.SERVER_CONNECT_ERROR);
                }
            }
            catch (Exception e)
            {
                UIErrorHelper.ShowAlert(string.Empty, e.Message);
            }
        }
        public void InitialiseViews()
        {
            outlineViewDataSource = new OutlineViewDataSource(Servernode);
            splitViewController.MainOutlineView.DataSource                          = outlineViewDataSource;
            splitViewController.MainOutlineView.Activated                          += OnOutlineViewActivated;
            splitViewController.MainOutlineView.SelectionDidChange                 += OnOutlineViewActivated;
            splitViewController.MainOutlineView.OutlineTableColumn.DataCell         = new NSBrowserCell();
            splitViewController.MainOutlineView.OutlineTableColumn.HeaderCell.Title = " Connected to " + Servernode.ServerDTO.Server;

            SetToolBarState(true);
            (NSApplication.SharedApplication.Delegate as AppDelegate).OpenConnectionMenuItem.Hidden = true;
            LoggedUserLabel.StringValue = "Logged in : " + Servernode.ServerDTO.UserName + "@" + Servernode.ServerDTO.DomainName;

            VMCAAppEnvironment.Instance.LocalData.AddServer(Servernode.ServerDTO);
            //Assign delegates
            splitViewController.MainOutlineView.Delegate = new OutlineDelegate(this);
            splitViewController.MainTableView.Delegate   = new TableDelegate(this);
            splitViewController.MainOutlineView.SelectRow(0, true);
        }
Esempio n. 9
0
        private void InitialiseViews()
        {
            AppDelegate appDelegate = NSApplication.SharedApplication.Delegate as AppDelegate;

            appDelegate.OpenConnectionMenuITem.Hidden = true;
            try
            {
                if (serverNode.IsLoggedIn)
                {
                    InitialiseDefaultOutlineView();
                    var indx = server.FindIndex(x => string.Equals(x.Server, serverNode.Server));
                    if (indx >= 0)
                    {
                        server.RemoveAt(indx);
                    }
                    VMDirSnapInEnvironment.Instance.LocalData.AddServer(serverNode);
                    DirectoryNode baseNode = new DirectoryNode(serverNode.BaseDN, new List <string>()
                    {
                        string.Empty
                    }, serverNode, null);
                    baseNode.IsBaseNode   = true;
                    outlineViewDataSource = new OutlineViewDataSource(baseNode);
                    splitViewController.VmdirOutlineView.DataSource = outlineViewDataSource;
                    baseNode.Expand(serverNode.BaseDN);
                    SetToolBarState(true);
                    InitialiseDefaultTableView();
                    StatusLabel.StringValue = "Logged in : " + serverNode.BindDN;
                }
                else
                {
                    UIErrorHelper.ShowAlert(VMDirConstants.ERR_LOGIN_FAILED, "Login not successful!");
                }
            }
            catch (Exception e)
            {
                CloseConnection();
                UIErrorHelper.ShowAlert(e.Message, "Login not successful!");
            }
        }
        /// <summary>
        /// Posts the refresh.
        /// </summary>
        private void PostRefresh()
        {
            try {
                controller.SetRefreshText(Constants.LoadingTopologyDetails);
                var treeDataSource = new OutlineViewDataSource(_rootNode);
                controller.TreeView.DataSource          = treeDataSource;
                controller.TreeView.Activated          += OnOutlineViewActivated;
                controller.TreeView.SelectionDidChange += OnOutlineViewActivated;
                controller.TreeView.OutlineTableColumn.HeaderCell.Title = "Connected to " + _serverDto.Server;
                controller.TreeView.Delegate = new OutlineDelegate(this);
                controller.TreeView.OutlineTableColumn.DataCell = new NSBrowserCell();

                if ((int)controller.TreeView.SelectedRow <= 0)
                {
                    controller.TreeView.SelectRow(0, true);
                }
                OnOutlineViewActivated(this, EventArgs.Empty);
            } catch (Exception exc) {
                // Log exception
            }
            controller.SetRefreshStatus(false);
            ServerToolBarItem.Enabled  = true;
            RefreshToolBarItem.Enabled = true;
        }