public bool FuelDataWithData(RoyalBase data)
        {
            if (!this.IsInitialized)
            {
                return(true);
            }

            if (!ValidateUiData(data))
            {
                return(false);
            }

            RoyalRDSConnection obj = (RoyalRDSConnection)data;

            if (!obj.IsDefaultSetting)
            {
                obj.URI  = textFieldComputerName.StringValue;
                obj.Name = textFieldDisplayName.StringValue;
            }

            obj.Description     = textFieldConnectionDescription.StringValue;
            obj.PhysicalAddress = textFieldPhysicalAddress.StringValue;

            return(true);
        }
        public void FuelUiWithData(RoyalBase data)
        {
            RoyalRDSConnection obj = (RoyalRDSConnection)data;

            textFieldDisplayName.StringValue = obj.Name;

            if (!obj.IsDefaultSetting)
            {
                textFieldComputerName.StringValue = obj.URI;
            }
            else
            {
                textFieldComputerName.IsEnabled = false;
                textFieldDisplayName.IsEnabled  = false;
            }

            buttonComputerNameEditor.IsEnabled = (!obj.IsDefaultSetting && EditMode == ObjectEditMode.EditMode_New);

            textFieldConnectionDescription.StringValue = obj.Description;
            textFieldPhysicalAddress.StringValue       = obj.PhysicalAddress;

            metadataView.RoyalObject = obj;

            this.IsInitialized = true;
        }
        private void LogConnectionInfo()
        {
            RoyalRDSConnection rdpData = Data as RoyalRDSConnection;

            bool           autologon     = rdpData.TemporaryGet(() => { return(rdpData.CredentialAutologon); });
            CredentialInfo effectiveCred = rdpData.TemporaryGet(() => { return(rdpData.GetEffectiveCredential()); });

            string hostname = rdpData.TemporaryGet(() => { return(rdpData.URI.ResolveTokensApi(rdpData)); });
            int    port     = rdpData.TemporaryGet(() => { return(rdpData.RDPPort); });

            string username = string.Empty;
            string password = string.Empty;

            if (autologon && effectiveCred != null)
            {
                username = effectiveCred.Username;
                password = effectiveCred.Password;
            }

            int screenWidth  = 0;
            int screenHeight = 0;

            rdpData.TemporaryAction(() => {
                if (rdpData.DesktopWidth == 0 && rdpData.DesktopHeight == 0)
                {
                    NSView connectionPlaceholderView = TabViewItem.View.CastTo <NSView>();

                    screenWidth  = (int)connectionPlaceholderView.Frame.Width;
                    screenHeight = (int)connectionPlaceholderView.Frame.Height;
                }
                else
                {
                    screenWidth  = rdpData.DesktopWidth;
                    screenHeight = rdpData.DesktopHeight;
                }
            });

            bool console = rdpData.TemporaryGet(() => { return(rdpData.ConnectToAdministerOrConsole); });

            StringBuilder details = new StringBuilder();

            details.AppendLine(string.Format("Hostname: {0}", hostname));
            details.AppendLine(string.Format("Port: {0}", port));
            details.AppendLine(string.Format("Console: {0}", console));
            details.AppendLine(string.Format("AutoLogon: {0}", autologon));
            details.AppendLine(string.Format("Username: {0}", username));
            details.AppendLine(string.Format("Password: {0}", password));
            details.AppendLine(string.Format("Resolution: {0}x{1}", screenWidth, screenHeight));

            ApiUtils.Log.Add(new RoyalLogEntry()
            {
                Severity   = RoyalLogEntry.Severities.Debug,
                Action     = "DummyConnection",
                PluginID   = PLUGIN_ID,
                PluginName = PLUGIN_NAME,
                Message    = "Connection Info",
                Details    = details.ToString()
            });
        }
        public void FuelUiWithData(RoyalBase data)
        {
            RoyalRDSConnection obj = (RoyalRDSConnection)data;

            checkBoxCustomPort.State = (obj.RDPPort == 3389 ? NSCellStateValue.NSOffState : NSCellStateValue.NSOnState);
            CheckBoxCustomPort_Action(checkBoxCustomPort);

            textFieldCustomPort.IntValue = obj.RDPPort;
            checkBoxConsoleSession.State = obj.ConnectToAdministerOrConsole.ToNSCellStateValue();

            this.IsInitialized = true;
        }
Esempio n. 5
0
        public void FuelUiWithData(RoyalBase data)
        {
            RoyalRDSConnection obj = (RoyalRDSConnection)data;

            checkBoxDesktopBackground.State               = obj.AllowWallpaper.ToNSCellStateValue();
            checkBoxMenuAndWindowAnimations.State         = obj.AllowMenuAnimations.ToNSCellStateValue();
            checkBoxShowWindowContentsWhileDragging.State = obj.AllowFullWindowDrag.ToNSCellStateValue();
            checkBoxFontSmoothing.State = obj.AllowFontSmoothing.ToNSCellStateValue();
            checkBoxVisualStyles.State  = obj.AllowThemes.ToNSCellStateValue();

            this.IsInitialized = true;
        }
        public void FuelUiWithData(RoyalBase data)
        {
            RoyalRDSConnection obj = (RoyalRDSConnection)data;

            switch (obj.ColorDepth)
            {
            case 8:
                popupButtonColors.SelectItemAtIndex(0);
                break;

            case 16:
                popupButtonColors.SelectItemAtIndex(1);
                break;

            case 24:
                popupButtonColors.SelectItemAtIndex(2);
                break;

            default:
                popupButtonColors.SelectItemAtIndex(2);
                break;
            }

            if (obj.DesktopWidth == 0 && obj.DesktopHeight == 0)
            {
                this.popupButtonDesktopSize.SelectItemAtIndex(0);
            }
            else
            {
                this.popupButtonDesktopSize.SelectItemAtIndex(1);
                this.textFieldCustomSizeWidth.IntValue  = obj.DesktopWidth;
                this.textFieldCustomSizeHeight.IntValue = obj.DesktopHeight;
            }

            PopupButtonDesktopSize_Action(this);

            if (obj.SmartReconnect)
            {
                this.popupButtonResizeMode.SelectItemAtIndex(1);
            }
            else             // Smart Size falls back to Scroll Bars
            {
                this.popupButtonResizeMode.SelectItemAtIndex(0);
            }

            PopupButtonResizeMode_Action(this);

            this.IsInitialized = true;
        }
        public bool FuelDataWithData(RoyalBase data)
        {
            if (!this.IsInitialized)
            {
                return(true);
            }

            if (!ValidateUiData(data))
            {
                return(false);
            }

            RoyalRDSConnection obj = (RoyalRDSConnection)data;

            switch ((int)this.popupButtonColors.IndexOfSelectedItem)
            {
            case 0:
                obj.ColorDepth = 8;
                break;

            case 1:
                obj.ColorDepth = 16;
                break;

            case 2:
                obj.ColorDepth = 24;
                break;
            }

            if (this.popupButtonDesktopSize.IndexOfSelectedItem == 0)
            {
                obj.DesktopWidth  = 0;
                obj.DesktopHeight = 0;
            }
            else if (this.popupButtonDesktopSize.IndexOfSelectedItem == 1)
            {
                obj.DesktopWidth  = this.textFieldCustomSizeWidth.IntValue;
                obj.DesktopHeight = this.textFieldCustomSizeHeight.IntValue;
            }

            obj.SmartSizing    = false;
            obj.SmartReconnect = popupButtonResizeMode.IndexOfSelectedItem == 1;

            return(true);
        }
        public void FuelUiWithData(RoyalBase data)
        {
            RoyalRDSConnection obj = (RoyalRDSConnection)data;

            if (obj.AudioRedirectionMode == 2)
            {
                this.popupButtonAudio.SelectItemAtIndex(1);
            }
            else             // Bring to this computer falls back to leave at remote computer
            {
                this.popupButtonAudio.SelectItemAtIndex(0);
            }

            this.checkBoxPrinters.State   = obj.RedirectPrinters.ToNSCellStateValue();
            this.checkBoxDiskDrives.State = obj.RedirectDrives.ToNSCellStateValue();

            this.IsInitialized = true;
        }
        public bool FuelDataWithData(RoyalBase data)
        {
            if (!this.IsInitialized)
            {
                return(true);
            }

            if (!ValidateUiData(data))
            {
                return(false);
            }

            RoyalRDSConnection obj = (RoyalRDSConnection)data;

            obj.RDPPort = textFieldCustomPort.IntValue;
            obj.ConnectToAdministerOrConsole = checkBoxConsoleSession.State.ToBool();

            return(true);
        }
        public bool FuelDataWithData(RoyalBase data)
        {
            if (!this.IsInitialized)
            {
                return(true);
            }

            if (!ValidateUiData(data))
            {
                return(false);
            }

            RoyalRDSConnection obj = (RoyalRDSConnection)data;

            obj.AudioRedirectionMode = this.popupButtonAudio.IndexOfSelectedItem == 0 ? 1 : 2;

            obj.RedirectPrinters = this.checkBoxPrinters.State.ToBool();
            obj.RedirectDrives   = this.checkBoxDiskDrives.State.ToBool();

            return(true);
        }
Esempio n. 11
0
        public bool FuelDataWithData(RoyalBase data)
        {
            if (!this.IsInitialized)
            {
                return(true);
            }

            if (!ValidateUiData(data))
            {
                return(false);
            }

            RoyalRDSConnection obj = (RoyalRDSConnection)data;

            obj.AllowWallpaper      = checkBoxDesktopBackground.State.ToBool();
            obj.AllowMenuAnimations = checkBoxMenuAndWindowAnimations.State.ToBool();
            obj.AllowFullWindowDrag = checkBoxShowWindowContentsWhileDragging.State.ToBool();
            obj.AllowFontSmoothing  = checkBoxFontSmoothing.State.ToBool();
            obj.AllowThemes         = checkBoxVisualStyles.State.ToBool();

            return(true);
        }
Esempio n. 12
0
        public override void Connect()
        {
            string sel = "connectWithOptions:";

            RoyalRDSConnection rdpData = Data as RoyalRDSConnection;

            rdpData.BeginTemporaryMode();
            bool autologon = rdpData.CredentialAutologon;

            NSString hostname = rdpData.URI.ResolveTokensApi(rdpData).NS();
            int      port     = rdpData.RDPPort;

            rdpData.EndTemporaryMode();

            NSString username = NSString.Empty;
            //NSString domain = NSString.Empty;
            NSString password = NSString.Empty;

            rdpData.BeginTemporaryMode();
            CredentialInfo effectiveCred = rdpData.GetEffectiveCredential();

            rdpData.EndTemporaryMode();

            if (autologon && effectiveCred != null)
            {
                string usernameStr = effectiveCred.Username;
                string passwordStr = effectiveCred.Password;

                username = usernameStr.NS();
                password = passwordStr.NS();
            }

            int screenWidth  = 0;
            int screenHeight = 0;

            if (rdpData.DesktopWidth == 0 && rdpData.DesktopHeight == 0)
            {
                screenWidth  = (int)TabViewItem.View.CastTo <NSView>().Frame.Width;
                screenHeight = (int)TabViewItem.View.CastTo <NSView>().Frame.Height;
            }
            else
            {
                rdpData.BeginTemporaryMode();
                screenWidth  = rdpData.DesktopWidth;
                screenHeight = rdpData.DesktopHeight;
                rdpData.EndTemporaryMode();
            }

            // TODO: Screen Width should actually be a multitude of 4, not 8, but 8 seems to work just fine with rdesktop
            if (screenWidth % 8 != 0)
            {
                screenWidth = (screenWidth / 8) * 8;
            }

            m_screenWidth  = screenWidth;
            m_screenHeight = screenHeight;

            CordRdpOptions options = new CordRdpOptions();

            rdpData.BeginTemporaryMode();
            options.Hostname = hostname;
            options.Port     = port;
            options.Username = username;
            //options.Domain = domain;
            options.Password         = password;
            options.ConnectToConsole = rdpData.ConnectToAdministerOrConsole;
            options.SmartSize        = false;      //rdpData.SmartSizing;
            options.ScreenWidth      = screenWidth;
            options.ScreenHeight     = screenHeight;
            options.ColorDepth       = rdpData.ColorDepth;
            options.AllowWallpaper   = rdpData.AllowWallpaper;
            options.AllowAnimations  = rdpData.AllowMenuAnimations;
            options.FontSmoothing    = rdpData.AllowFontSmoothing;
            options.ShowWindowContentsWhileDragging = rdpData.AllowFullWindowDrag;
            options.ShowThemes           = rdpData.AllowThemes;
            options.RedirectPrinters     = rdpData.RedirectPrinters;
            options.RedirectDiskDrives   = rdpData.RedirectDrives;
            options.AudioRedirectionMode = rdpData.AudioRedirectionMode;
            rdpData.EndTemporaryMode();

            if (m_nativeController.RespondsToSelector(sel))
            {
                m_nativeController.SendMessage(sel, options);
            }

            options.Release();
        }
        partial void ButtonComputerNameEditor_Action(Id sender)
        {
            string computers = RmComputerPicker.Show(View.Window, new RmComputerPickerArguments()
            {
                BonjourEnabled     = false,
                CustomEntryEnabled = EditMode == ObjectEditMode.EditMode_New,
                CanAddMultiple     = EditMode == ObjectEditMode.EditMode_New,
                CurrentHosts       = textFieldComputerName.StringValue
            });

            if (!string.IsNullOrWhiteSpace(computers))
            {
                string[] computerLines = computers.Split(new string[] { "\r\n", "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries);

                if (computerLines.Length == 1)
                {
                    RoyalRDSConnection con = new RoyalRDSConnection(null);
                    con.ExtendWithTaggedComputerString(computerLines[0]);

                    if (!string.IsNullOrWhiteSpace(con.Name))
                    {
                        textFieldDisplayName.StringValue = con.Name.NS();
                    }

                    if (!string.IsNullOrWhiteSpace(con.Description))
                    {
                        textFieldDescription.StringValue = con.Description.NS();
                    }

                    if (!string.IsNullOrWhiteSpace(con.URI))
                    {
                        textFieldComputerName.StringValue = con.URI.NS();
                        CheckIfIsInBulkAddMode();
                    }
                }
                else if (computerLines.Length > 1)
                {
                    if (EditMode == ObjectEditMode.EditMode_New)
                    {
                        string hostsJoined = string.Empty;

                        foreach (string host in computerLines)
                        {
                            hostsJoined += host + ";";
                        }

                        if (hostsJoined.EndsWith(";"))
                        {
                            hostsJoined = hostsJoined.Substring(0, hostsJoined.LastIndexOf(";"));
                        }

                        textFieldComputerName.StringValue = hostsJoined.NS();
                        CheckIfIsInBulkAddMode();
                    }
                    else
                    {
                        RmMessageBox.Show(
                            RmMessageBoxType.WarningMessage,
                            this.View.Window,
                            "Warning".TL(),
                            "Bulk-add can only be used when adding new connections.".TL(),
                            "OK".TL()
                            );
                    }
                }
            }
        }
		partial void ButtonComputerNameEditor_Action (Id sender)
		{
			string computers = RmComputerPicker.Show(this.View.Window, new RmComputerPickerArguments() {
				BonjourEnabled = false,
				CustomEntryEnabled = this.EditMode == ObjectEditMode.EditMode_New,
				CanAddMultiple = this.EditMode == ObjectEditMode.EditMode_New,
				CurrentHosts = textFieldComputerName.StringValue
			});
			
			if (!string.IsNullOrWhiteSpace(computers)) {
				string[] computerLines = computers.Split(new string[] { "\r\n", "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries);
				
				if (computerLines.Length == 1) {
					RoyalRDSConnection con = new RoyalRDSConnection(null);
					ApiUtils.ExtendConnectionWithTaggedComputerString(con, computerLines[0]);
					
					if (!string.IsNullOrWhiteSpace(con.Name))
						textFieldDisplayName.StringValue = con.Name;
					
					if (!string.IsNullOrWhiteSpace(con.Description))
						textFieldConnectionDescription.StringValue = con.Description;

					if (!string.IsNullOrWhiteSpace(con.URI)) {
						textFieldComputerName.StringValue = con.URI;
						CheckIfIsInBulkAddMode();
					}
				} else if (computerLines.Length > 1) {
					if (this.EditMode == ObjectEditMode.EditMode_New) {
						string hostsJoined = string.Empty;
						
						foreach (string host in computerLines) {
							hostsJoined += host + ";";
						}
						
						if (hostsJoined.EndsWith(";"))
							hostsJoined = hostsJoined.Substring(0, hostsJoined.LastIndexOf(";"));
						
						textFieldComputerName.StringValue = hostsJoined;
						CheckIfIsInBulkAddMode();
					} else {
						RmMessageBox.Show(RmMessageBoxType.WarningMessage,
						                  this.View.Window, 
						                  "Warning".TL(),
						                  "Bulk-add can only be used when adding new connections.".TL(),
						                  "OK".TL());
					}
				}
			}
		}