Esempio n. 1
0
        static void RegisterRemoteControl(NoteManager manager)
        {
            try {
                remote_control = RemoteControlProxy.Register(manager);
                if (remote_control != null)
                {
                    Logger.Debug("Tomboy remote control active.");
                }
                else
                {
                    // If Tomboy is already running, open the search window
                    // so the user gets some sort of feedback when they
                    // attempt to run Tomboy again.
                    IRemoteControl remote = null;
                    try {
                        remote = RemoteControlProxy.GetInstance();
                        remote.DisplaySearch();
                    } catch {}

                    Logger.Error("Tomboy is already running.  Exiting...");
                    System.Environment.Exit(-1);
                }
            } catch (Exception e) {
                Logger.Warn("Tomboy remote control disabled (DBus exception): {0}",
                            e.Message);
            }
        }
Esempio n. 2
0
 private void ConnectButton_Click(object sender, EventArgs e)
 {
     if (ConnectButton.Text == "Connect")
     {
         try
         {
             _remoteControl     = new RemoteControl(IpAddressTextBox.Text, Int32.Parse(PortNumberTextBox.Text));
             ConnectButton.Text = "Disconnect";
             setInputsState(false);
             tableLayoutPanel1.Focus();
         }
         catch (Exception err)
         {
             MessageBox.Show($"Błąd połączenia: {err.Message}", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
             ConnectButton.Text = "Connect";
             setInputsState(true);
         }
     }
     else
     {
         _remoteControl.Dispose();
         ConnectButton.Text = "Connect";
         setInputsState(true);
     }
 }
Esempio n. 3
0
        protected virtual void Open()
        {
            string uri = string.Format("net.pipe://localhost/{0}/RemoteControl.svc", _appName);

            var myBinding = new NetNamedPipeBinding();
            var myEndpoint = new EndpointAddress(uri);
            var myChannelFactory = new ChannelFactory<IRemoteControl>(myBinding, myEndpoint);
            _proxy = myChannelFactory.CreateChannel();
        }
 public void GoBack()
 {
     if (WindowStack.Count > 0)
     {
         IRemoteControl previous = PopAvailableWindow();
         this.CurrentWindow = null;
         ShowWindow(previous);
     }
 }
Esempio n. 5
0
        protected virtual void Open()
        {
            string uri = string.Format("http://{0}:{1}/{2}/RemoteControl.svc", _server, _port, _appName);

            var myBinding = new BasicHttpBinding();
            var myEndpoint = new EndpointAddress(uri);
            var myChannelFactory = new ChannelFactory<IRemoteControl>(myBinding, myEndpoint);
            _proxy = myChannelFactory.CreateChannel();
        }
        protected virtual void Open()
        {
            string uri = string.Format("http://{0}:{1}/{2}/RemoteControl.svc", _server, _port, _appName);

            var myBinding        = new BasicHttpBinding();
            var myEndpoint       = new EndpointAddress(uri);
            var myChannelFactory = new ChannelFactory <IRemoteControl>(myBinding, myEndpoint);

            _proxy = myChannelFactory.CreateChannel();
        }
        protected virtual void Open()
        {
            string uri = $"http://localhost/{_appName}/RemoteControl.svc";

            var myBinding        = new WSHttpBinding();
            var myEndpoint       = new EndpointAddress(uri);
            var myChannelFactory = new ChannelFactory <IRemoteControl>(myBinding, myEndpoint);

            _proxy = myChannelFactory.CreateChannel();
        }
        public void GoHome()
        {
            IRemoteControl homeWindow = CurrentWindow;

            while (WindowStack.Count > 0)
            {
                homeWindow = PopAvailableWindow();
            }
            this.CurrentWindow = null;
            ShowWindow(homeWindow);
        }
Esempio n. 9
0
        public void Initialize()
        {
            m_Television = new Television.Models.Television(MAX_CHANNELS);
            m_RemoteReceiver = new Television.Models.RemoteReceiver(m_Television);
            m_RemoteControl = new Television.Models.RemoteControl();
            m_RemoteControl.Program((result) =>
            {
                // Verify we are programmed
                Assert.IsTrue(result);
            });

            System.Threading.Thread.Yield();    // Allow the remote time to be programmed
        }
Esempio n. 10
0
 public void GoBack(IRemoteControl window)
 {
     if (window == null)
     {
         throw new ArgumentException("Window argument cannot be null");
     }
     if (window.Equals(CurrentWindow) && WindowStack.Count > 0)
     {
         window             = PopAvailableWindow();
         this.CurrentWindow = null;
         ShowWindow(window);
     }
 }
Esempio n. 11
0
 public void NextState(IRemoteControl control)
 {
     if (control.CurrentFeature == FeatureType.Sleep)
     {
         control.CurrentFeature = FeatureType.Condition;
         Console.WriteLine("目前轉成冷氣模式");
     }
     else
     {
         control.FeatureState = new ConditionState();
         control.ChangeFeatures();
     }
 }
Esempio n. 12
0
 public void NextState(IRemoteControl control)
 {
     if (control.CurrentFeature == FeatureType.Fan)
     {
         control.CurrentFeature = FeatureType.Dehumidify;
         Console.WriteLine("目前轉成除濕模式");
     }
     else
     {
         control.FeatureState = new DehumidifyState();
         control.ChangeFeatures();
     }
 }
Esempio n. 13
0
        public void ShowWindow(IRemoteControl window)
        {
            if (window == null)
            {
                throw new ArgumentException("Window argument cannot be null");
            }

            bool   IsContract           = false;
            bool   IsAirspaceDecoration = false;
            object Control = null;

            try {
                Control = window.GetControl();
            } catch (SerializationException) {
                INativeHandleContract contract = window.GetControl(true) as INativeHandleContract;
                if (contract != null)
                {
                    Control              = FrameworkElementAdapters.ContractToViewAdapter(contract);
                    IsContract           = true;
                    IsAirspaceDecoration = window.EnableAirspaceFix;
                }
            }
            if (Control != null)
            {
                if (CurrentWindow != null)
                {
                    WindowStack.Push(CurrentWindow);
                }

                if (IsContract && IsAirspaceDecoration)
                {
                    Control = new AirspaceDecorator()
                    {
                        AirspaceMode = AirspaceMode.Redirect,
                        IsInputRedirectionEnabled  = true,
                        IsOutputRedirectionEnabled = true,
                        Background = Brushes.White,
                        Content    = Control
                    };
                }

                CurrentWindow = window;
                CurrentWindow.OnShow();
                UpdateTransition(Control, ((IsContract && !IsAirspaceDecoration) || (this.IsContract && !this.IsAirspaceDecoration))
                    ? TransitionType.Normal
                    : DefaultTransition);
                this.IsContract           = IsContract;
                this.IsAirspaceDecoration = IsAirspaceDecoration;
            }
        }
Esempio n. 14
0
        private IRemoteControl PopAvailableWindow()
        {
            bool           IsSuccess = false;
            IRemoteControl control   = null;

            while (!IsSuccess)
            {
                try {
                    WindowStack.TryPop(out control);
                    var boolEnabled = control.EnableAirspaceFix;
                    IsSuccess = true;
                } catch (AppDomainUnloadedException) { }
            }
            return(control);
        }
Esempio n. 15
0
 private void WindowButtonCommands_MaxButtonClick(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (WindowState == WindowState.Normal)//准备点击最大化按钮
     {
         IRemoteControl remoteControl = MainTabControl.SelectedContent as RemoteTabControl;
         if (remoteControl != null)
         {
             bool state = remoteControl.FullScreen(true);
             if (state)
             {
                 e.Cancel = true;
             }
         }
     }
 }
Esempio n. 16
0
        /// <summary>打开远程桌面</summary>
        public static void OpenRemote(RemoteTreeViewItem treeTtem, int openMode)
        {
            IRemoteControl   remoteControl  = null;
            DbItemRemoteLink itemRemoteLink = Database.GetRemoteLink(treeTtem.uuid);

            if (string.IsNullOrEmpty(itemRemoteLink.Server))
            {
                throw new Exception("服务器地址不能为空。");
            }

            DbItemSetting itemSetting = Database.GetRemoteSetting(itemRemoteLink);

            if (openMode == DbItemSetting.OPEN_DEFAULT)
            {
                openMode = new FinalItemSetting(itemSetting).OpenMode;
            }

            //如果指定的远程桌面有在后台运行,则跳转
            if (_remoteRunTime.ContainsKey(treeTtem.uuid))
            {
                var value = _remoteRunTime[treeTtem.uuid];
                if (value.OpenMode == openMode)
                {
                    value.RemoteControl.Jump();
                    return;
                }
                value.RemoteControl.Remove();
                _remoteRunTime.Remove(treeTtem.uuid);
            }

            //开始连接远程桌面
            if (openMode == DbItemSetting.OPEN_WINDOW)
            {
                remoteControl = new RemoteWinControl();
            }
            else
            {
                remoteControl = new RemoteTabControl();
            }
            remoteControl.Open(itemRemoteLink, itemSetting, openMode == DbItemSetting.OPEN_TAB);
            _remoteRunTime.Add(treeTtem.uuid, new RemoteRunTime(openMode, remoteControl));
            remoteControl.OnRemove += (sender, e) => _remoteRunTime.Remove(treeTtem.uuid);
        }
Esempio n. 17
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(IModelElement item)
 {
     if ((this._parent.RegulatingCondEq == null))
     {
         IRegulatingCondEq regulatingCondEqCasted = item.As <IRegulatingCondEq>();
         if ((regulatingCondEqCasted != null))
         {
             this._parent.RegulatingCondEq = regulatingCondEqCasted;
             return;
         }
     }
     if ((this._parent.ControlType == null))
     {
         IControlType controlTypeCasted = item.As <IControlType>();
         if ((controlTypeCasted != null))
         {
             this._parent.ControlType = controlTypeCasted;
             return;
         }
     }
     if ((this._parent.Unit == null))
     {
         IUnit unitCasted = item.As <IUnit>();
         if ((unitCasted != null))
         {
             this._parent.Unit = unitCasted;
             return;
         }
     }
     if ((this._parent.RemoteControl == null))
     {
         IRemoteControl remoteControlCasted = item.As <IRemoteControl>();
         if ((remoteControlCasted != null))
         {
             this._parent.RemoteControl = remoteControlCasted;
             return;
         }
     }
 }
 public void Dispose()
 {
     ((ICommunicationObject)_proxy).Close();
     _proxy = null;
 }
Esempio n. 19
0
 public DevicesController(IUowData data, IRemoteControl remoteControl)
     : base(data, remoteControl)
 {
 }
 public RemoteControlForm(IRemoteControl remote)
     : this()
 {
     _remote = remote;
     _remote.NotesChanged += OnNotesChanged;
 }
Esempio n. 21
0
        public void Execute()
        {
            IRemoteControl remote = null;

            try {
                remote = RemoteControlProxy.GetInstance();
            } catch (Exception e) {
                Logger.Error("Unable to connect to Tomboy remote control: {0}",
                             e.Message);
            }

            if (remote == null)
            {
                return;
            }

            if (new_note)
            {
                string new_uri;

                if (new_note_name != null)
                {
                    new_uri = remote.FindNote(new_note_name);

                    if (new_uri == null || new_uri == string.Empty)
                    {
                        new_uri = remote.CreateNamedNote(new_note_name);
                    }
                }
                else
                {
                    new_uri = remote.CreateNote();
                }

                if (new_uri != null)
                {
                    remote.DisplayNote(new_uri);
                }
            }

            if (open_start_here)
            {
                open_note_uri = remote.FindStartHereNote();
            }

            if (open_note_name != null)
            {
                open_note_uri = remote.FindNote(open_note_name);
            }

            if (open_note_uri != null)
            {
                if (highlight_search != null)
                {
                    remote.DisplayNoteWithSearch(open_note_uri,
                                                 highlight_search);
                }
                else
                {
                    remote.DisplayNote(open_note_uri);
                }
            }

            if (open_external_note_path != null)
            {
                string note_id = Path.GetFileNameWithoutExtension(open_external_note_path);
                if (note_id != null && note_id != string.Empty)
                {
                    // Attempt to load the note, assuming it might already
                    // be part of our notes list.
                    if (remote.DisplayNote(
                            string.Format("note://tomboy/{0}", note_id)) == false)
                    {
                        StreamReader sr = File.OpenText(open_external_note_path);
                        if (sr != null)
                        {
                            string noteTitle = null;
                            string noteXml   = sr.ReadToEnd();

                            // Make sure noteXml is parseable
                            XmlDocument xmlDoc = new XmlDocument();
                            try {
                                xmlDoc.LoadXml(noteXml);
                            } catch {
                                noteXml = null;
                            }

                            if (noteXml != null)
                            {
                                noteTitle = NoteArchiver.Instance.GetTitleFromNoteXml(noteXml);
                                if (noteTitle != null)
                                {
                                    // Check for conflicting titles
                                    string baseTitle = (string)noteTitle.Clone();
                                    for (int i = 1; remote.FindNote(noteTitle) != string.Empty; i++)
                                    {
                                        noteTitle = baseTitle + " (" + i.ToString() + ")";
                                    }

                                    string note_uri = remote.CreateNamedNote(noteTitle);

                                    // Update title in the note XML
                                    noteXml = NoteArchiver.Instance.GetRenamedNoteXml(noteXml, baseTitle, noteTitle);

                                    if (note_uri != null)
                                    {
                                        // Load in the XML contents of the note file
                                        if (remote.SetNoteCompleteXml(note_uri, noteXml))
                                        {
                                            remote.DisplayNote(note_uri);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (open_search)
            {
                if (search_text != null)
                {
                    remote.DisplaySearchWithText(search_text);
                }
                else
                {
                    remote.DisplaySearch();
                }
            }

            if (addin_args)
            {
                AddinCmdLineArgsDetected(this, new EventArgs());
            }
        }
Esempio n. 22
0
 public RoomsController(IUowData data, IRemoteControl remoteControl)
     : base(data, remoteControl)
 {
 }
 public HouseSettingsController(IUowData data, IRemoteControl remoteControl)
     : base(data, remoteControl)
 {
 }
Esempio n. 24
0
 public ThermostatsController(IUowData data, IRemoteControl remoteControl)
     : base(data, remoteControl)
 {
 }
Esempio n. 25
0
 /// <summary>
 /// Initializes a new instance of <see cref="PageItem"/> for specified name, <see cref="IRemoteControl"/> and binding flag (false by default).
 /// </summary>
 /// <param name="Name">Item name</param>
 /// <param name="Content">Content or item</param>
 /// <param name="IsNameBinding">Is it binding name</param>
 public PageItem(string Name, IRemoteControl Content, bool IsNameBinding = false)
     : base(Name, IsNameBinding)
 {
     this.Content = Content;
 }
 public TempStatisticsController(IUowData data, IRemoteControl remoteControl)
     : base(data, remoteControl)
 {
 }
Esempio n. 27
0
 public FloorsController(IUowData data, IRemoteControl remoteControl)
     : base(data, remoteControl)
 {
 }
Esempio n. 28
0
 public RemoteRunTime(int openMode, IRemoteControl remoteControl)
 {
     OpenMode      = openMode;
     RemoteControl = remoteControl;
 }
Esempio n. 29
0
 public void Dispose()
 {
     ((ICommunicationObject)_proxy).Close();
     _proxy = null;
 }
 public void GoBack(IRemoteControl window)
 {
     if (window == null) {
         throw new ArgumentException("Window argument cannot be null");
     }
     if (window.Equals(CurrentWindow) && WindowStack.Count > 0) {
         window = PopAvailableWindow();
         this.CurrentWindow = null;
         ShowWindow(window);
     }
 }
Esempio n. 31
0
 public BaseController(IUowData data, IRemoteControl remoteControl)
 {
     this.Data = data;
     this.RemoteControl = remoteControl;
 }
Esempio n. 32
0
 /// <summary>
 /// Initializes a new instance of <see cref="PageItem"/> for specified name, <see cref="IRemoteControl"/> and binding flag (false by default).
 /// </summary>
 /// <param name="Name">Item name</param>
 /// <param name="Content">Content or item</param>
 /// <param name="IsNameBinding">Is it binding name</param>
 public PageItem(string Name, IRemoteControl Content, bool IsNameBinding = false)
     : base(Name, IsNameBinding)
 {
     this.Content = Content;
 }
Esempio n. 33
0
 public void SetRemoteControl(IRemoteControl remoteControl)
 {
     this.remoteControl = remoteControl;
 }