Esempio n. 1
0
    void Start()
    {
        GameController.OnlineDel += testExe;//

        lineRenderer = GetComponent <LineRenderer>();
        // Controllers
        manualInputControl = GetComponent <ManualInputControl>();
        selectionControl   = GetComponent <SelectionControl>();
        targetControl      = GetComponent <TargetControl>();
        commandControl     = GetComponent <CommandControl>();
        panelControl       = GetComponent <PanelControl>();

        //selectionControl.SetActiveAxis(target, false);
        axisCamera.SetActive(true);


        defaultPosition = target.position;
        target.GetComponent <ClampName>().textPanel.gameObject.SetActive(false);
        target.gameObject.SetActive(false);
        // Initial target

        //Destroy(target.GetComponent<ClampName>().textPanel.gameObject);
        //Destroy(target.gameObject);
        //SetTarget(targetControl.GetTarget(0));
        //selectionControl.SetActiveAxis(targetControl.GetTarget(0), false);


        UpdateTargets(targetControl.GetNames());

        commandsDropdown.AddOptions(commandControl.GetNames());
        CommandsDropdown_IndexChanged(0);
    }
Esempio n. 2
0
        private void ScrollToLetter(string letter)
        {
            if (TargetControl == null || TargetControl.ItemsSource == null)
            {
                return;
            }

            var collectionView = CollectionViewSource.GetDefaultView(TargetControl.ItemsSource);

            if (collectionView == null)
            {
                throw new InvalidOperationException("The TargetControl should use ICollectionView as ItemSource.");
            }

            if (string.IsNullOrEmpty(TargetPropertyPath))
            {
                throw new InvalidOperationException("TargetPropertyPath is not set.");
            }

            var firstWithLetter = collectionView.SourceCollection.Cast <object>().FirstOrDefault(o => o.DynamicAccess <string>(TargetPropertyPath)?.StartsWith(letter, true, CultureInfo.InvariantCulture) ?? false);

            if (firstWithLetter != null)
            {
                var scrollViewer = TargetControl.FindChild <ScrollViewer>();
                scrollViewer.ScrollToBottom();
                TargetControl.ScrollIntoView(firstWithLetter);
            }
        }
Esempio n. 3
0
 public void Register()
 {
     AttackOptionsControl.RegisterControlsStore(this);
     ProxySettingsControl.RegisterControlsStore(this);
     TargetControl.RegisterControlsStore(this);
     WorkersControl.RegisterControlsStore(this);
 }
Esempio n. 4
0
        /// <summary>
        /// Called when the <c>DataContext</c> property of the <see cref="TargetControl"/> has changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
        public virtual void OnTargetControlDataContextChanged(object sender, DependencyPropertyValueChangedEventArgs e)
        {
            Log.Debug("DataContext of TargetControl '{0}' has changed to '{1}'", TargetControl.GetType().Name, ObjectToStringHelper.ToTypeString(TargetControl.DataContext));

            var dataContext = TargetControl.DataContext;

            if (dataContext == null)
            {
                return;
            }

            if (BindingHelper.IsSentinelObject(dataContext))
            {
                return;
            }

            if (ViewModel == dataContext)
            {
                return;
            }

            if (dataContext.GetType().IsAssignableFromEx(ViewModelType))
            {
                // Use the view model from the data context, probably set manually
                ViewModel = (IViewModel)dataContext;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Determines the interesting dependency properties.
        /// </summary>
        /// <returns>A list of names with dependency properties to subscribe to.</returns>
        private List <DependencyPropertyInfo> DetermineInterestingDependencyProperties()
        {
            var targetControlType = TargetControlType;

            return(_dependencyPropertiesToSubscribe.GetFromCacheOrFetch(targetControlType, () =>
            {
                var controlDependencyProperties = TargetControl.GetDependencyProperties();
                var dependencyProperties = new List <DependencyPropertyInfo>();

                if ((_dependencyPropertySelector == null) || (_dependencyPropertySelector.MustSubscribeToAllDependencyProperties(targetControlType)))
                {
                    dependencyProperties.AddRange(controlDependencyProperties);
                }
                else
                {
                    var dependencyPropertiesToSubscribe = _dependencyPropertySelector.GetDependencyPropertiesToSubscribeTo(targetControlType);
                    if (!dependencyPropertiesToSubscribe.Contains("DataContext"))
                    {
                        dependencyPropertiesToSubscribe.Add("DataContext");
                    }

                    foreach (var gatheredDependencyProperty in controlDependencyProperties)
                    {
                        if (dependencyPropertiesToSubscribe.Contains(gatheredDependencyProperty.PropertyName))
                        {
                            dependencyProperties.Add(gatheredDependencyProperty);
                        }
                    }
                }

                return dependencyProperties;
            }));
        }
        /// <summary>7
        /// Overridden OnPreRender method. Build data-options and add it into extender target as an data-options attribute.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (DesignMode)
            {
                return;
            }

            var dataOptions       = JQueryScriptBuilder.BuildDataOptionsAttribute(this);
            var targetControl     = this.TargetControl as WebControl;
            var htmlTargetControl = this.TargetControl as HtmlControl;

            if (targetControl == null && htmlTargetControl == null)
            {
                throw new Exception("Target control type must be WebControl or HtmlControl");
            }

            _targetControlType = TargetControl.GetType();

            TargetControl.Parent.SetRenderMethodDelegate(RenderTargetControl);
            var attrs = (targetControl != null)
                            ? (targetControl is CheckBox)
                ? (targetControl as CheckBox).InputAttributes
                                    : targetControl.Attributes
                            : (htmlTargetControl != null)
                                ? htmlTargetControl.Attributes
                                    : null;

            if (attrs != null)
            {
                attrs.Add(DataOptionPrefix + _attrControlName, dataOptions);
            }
        }
Esempio n. 7
0
        private void ScrollToMonth(int month)
        {
            if (TargetControl == null || TargetControl.ItemsSource == null)
            {
                return;
            }

            var collectionView = CollectionViewSource.GetDefaultView(TargetControl.ItemsSource);

            if (collectionView == null)
            {
                throw new InvalidOperationException("The TargetControl should use ICollectionView as ItemSource.");
            }

            if (string.IsNullOrEmpty(TargetPropertyPath))
            {
                throw new InvalidOperationException("TargetPropertyPath is not set.");
            }

            var firstAtMonth = collectionView.SourceCollection.Cast <object>().FirstOrDefault(o => o.DynamicAccess <DateTime?>(TargetPropertyPath)?.Month.Equals(month) ?? false);

            if (firstAtMonth != null)
            {
                var scrollViewer = TargetControl.FindChild <ScrollViewer>();
                scrollViewer.ScrollToBottom();
                TargetControl.ScrollIntoView(firstAtMonth);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Called when the <c>DataContext</c> property of the <see cref="TargetControl"/> has changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
        public override void OnTargetControlDataContextChanged(object sender, DependencyPropertyValueChangedEventArgs e)
        {
            // Fix in WinRT to make sure inner grid is created
            if (_viewModelGrid == null)
            {
                if (TargetControl.Content != null)
                {
                    TargetControl.UnsubscribeFromDependencyProperty("Content", OnTargetControlContentChanged);

                    CreateViewModelGrid();
                }
                else
                {
                    Log.Error("Content of control '{0}' is not yet loaded, but the DataContext has changed. The control will bind directly to the DataContext instead of the view model", TargetControl.GetType().FullName);
                }
            }

            base.OnTargetControlDataContextChanged(sender, e);

            var oldDataContext = e.OldValue;
            var dataContext    = e.NewValue;

            if (BindingHelper.IsSentinelObject(dataContext))
            {
                return;
            }

            if (oldDataContext != null)
            {
                ClearWarningsAndErrorsForObject(oldDataContext);
            }

            UpdateDataContextToUseViewModel(dataContext);
        }
        private void OnExpandedItemCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                ToggleItemRowsExpansion(e.NewItems, true);
            }

            if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                ToggleItemRowsExpansion(e.OldItems, false);
            }

            if (e.Action == NotifyCollectionChangedAction.Replace)
            {
                ToggleItemRowsExpansion(e.OldItems, false);
                ToggleItemRowsExpansion(e.NewItems, true);
            }

            if (e.Action == NotifyCollectionChangedAction.Reset)
            {
                for (int i = 0; i < TargetControl.VisibleRowCount; i++)
                {
                    int rowHandle = TargetControl.GetRowHandleByVisibleIndex(i);
                    if (TargetControl.IsGroupRowHandle(rowHandle))
                    {
                        continue;
                    }

                    if (TargetControl.IsMasterRowExpanded(rowHandle))
                    {
                        TargetControl.CollapseMasterRow(rowHandle);
                    }
                }
            }
        }
Esempio n. 10
0
    void Start()
    {
        targetControl = GetComponentInChildren <TargetControl> ();

        mTrackableBehaviour = GetComponent <TrackableBehaviour> ();
        if (mTrackableBehaviour)
        {
            mTrackableBehaviour.RegisterTrackableEventHandler(this);
        }
    }
Esempio n. 11
0
        public void Perform()
        {
            if (!TargetControl.InvokeRequired)
            {
                PerformCore();
                return;
            }

            TargetControl.Invoke((Action)Perform, null);
        }
Esempio n. 12
0
    // Use this for initialization
    void Start()
    {
        Load_Command();
        TargetControl  = GameC.GetComponent <TargetControl>();
        CommandControl = GameC.GetComponent <CommandControl>();
        Robot          = GameC.GetComponent <GameController>().robot;
        Online         = false;

        GameController.OnlineDel += Online_Offline;
    }
Esempio n. 13
0
 // Use this for initialization
 void Start()
 {
     Load_Command();
     Term               = Terminal.GetComponent <Terminal>();
     TargetControl      = GameC.GetComponent <TargetControl>();
     CommandControl     = GameC.GetComponent <CommandControl>();
     Robot              = GameC.GetComponent <GameController>().robot;
     Online             = false;
     Data               = false;
     Count_Command_Data = 0;
 }
Esempio n. 14
0
 private void RenderTick(TimeSpan time)
 {
     if (_isDisposed | !_hasNewFrame)
     {
         return;
     }
     lock (_globalUIThreadUpdateLock)
         lock (_bitmapSync)
         {
             TargetControl?.InvalidateVisual();
             _hasNewFrame = false;
         }
 }
        public bool NotifyControlChanged(UiControl control)
        {
            if (control == null)
            {
                return(false);
            }

            TargetControl tc = null;

            if (control == nameKey?.control)
            {
                tc = nameKey;
            }
            else if (control == subInspector?.control)
            {
                tc = subInspector;
            }
            else
            {
                return(false);
            }

            // Try setting the property/field values on target after reading it from UI control:
            bool success           = false;
            bool bindingSuccessful = false;

            try
            {
                success = tc.SetValue(accessor, control.RawValue);
                if (success && tc.IsContentBindingSource)
                {
                    bindingSuccessful = UiInspector.LoadContentBindingValues(this, tc, accessor.nameKey);
                }
            }
            catch (Exception ex)
            {
                Debug.LogError($"[UiControlSubInspector] ERROR! An exception was caught while trying to set a control's value to target member!\nException message: {ex.Message}");
                return(false);
            }

            // If the bound content was not found or could not be loaded, the key must have been invalid, so reset that:
            if (!bindingSuccessful)
            {
                nameKey.control.SetValue(string.Empty);
            }

            // Notify the host that this list or nested object has been changed:
            return(success && host != null?host.NotifyControlChanged(this) : success);
        }
 private void SetTextAndHide()
 {
     this.popup.IsOpen = false;
     if (this.listBox.SelectedItem != null)
     {
         TargetControl.Text = String.IsNullOrEmpty(DisplayMemberPath) ?
                              this.listBox.SelectedItem.ToString() :
                              this.listBox.SelectedItem.GetType().GetProperty(
             DisplayMemberPath).GetValue(this.listBox.SelectedItem, null).ToString();
         itemsSelected = true;
         if (MovesFocus)
         {
             TargetControl.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
         }
     }
 }
 void Awake()
 {
     // Controllers
     targetControl = GetComponent <TargetControl>();
     // Main state message
     stateOutput      = GetComponent <GameController>().stateOutput;
     stateOutputPanel = GetComponent <GameController>().stateOutput.transform.parent.GetComponent <Animator>();
     // Log state message
     messageLog         = GetComponent <GameController>().messageLog;
     contentLog         = GetComponent <GameController>().messageLog.transform.parent.gameObject;
     positionLog        = GetComponent <GameController>().positionLog;
     positionSyncLog    = GetComponent <GameController>().positionSyncLog;
     contentPositionLog = GetComponent <GameController>().positionLog.transform.parent.gameObject;
     positionCountLog   = GetComponent <GameController>().positionCountLog;
     messages           = new List <string>();
 }
Esempio n. 18
0
        /// <summary>
        /// Called when the <see cref="TargetControl"/> has just been unloaded.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks>
        /// This method will call the <see cref="OnTargetControlUnloaded"/> which can be overriden for custom
        /// behavior. This method is required to protect from duplicate unloaded events.
        /// </remarks>
        private void OnTargetControlUnloadedInternal(object sender, UIEventArgs e)
        {
            // Don't do this again (another bug in WPF: OnLoaded is called more than OnUnloaded)
            if (!IsTargetControlLoaded)
            {
                return;
            }

            InvokeViewLoadEvent(ViewLoadStateEvent.Unloading);

            IsUnloading = true;

            //#if !NET
            //            _isFirstLayoutUpdatedAfterUnloadedEvent = true;
            //#endif

            Log.Debug("Target control '{0}' is unloaded", TargetControl.GetType().Name);

            var view = TargetControl as IView;

            if (view == null)
            {
                Log.Warning("Cannot unregister view '{0}' in the view manager because it does not implement IView", TargetControl.GetType().FullName);
            }
            else
            {
                _viewManager.UnregisterView(view);
            }

            IsTargetControlLoaded         = false;
            _isFirstValidationAfterLoaded = true;

            OnTargetControlUnloaded(sender, e);

            var targetControlAsIViewModelContainer = TargetControl as IViewModelContainer;

            if (targetControlAsIViewModelContainer != null)
            {
                ViewToViewModelMappingHelper.UninitializeViewToViewModelMappings(targetControlAsIViewModelContainer);
            }

            IsUnloading = false;

            InvokeViewLoadEvent(ViewLoadStateEvent.Unloaded);
        }
Esempio n. 19
0
 public ControlsStore(
     MainForm mainForm,
     ProxySettingsControl proxySettingsControl,
     TargetControl targetControl,
     AttackOptionsControl attackOptionsControl,
     WorkersControl workersControl,
     StatusControl statusControl,
     TabPage tabAttackOptions
     )
 {
     MainForm             = mainForm;
     ProxySettingsControl = proxySettingsControl;
     TargetControl        = targetControl;
     AttackOptionsControl = attackOptionsControl;
     WorkersControl       = workersControl;
     StatusControl        = statusControl;
     TabAttackOptions     = tabAttackOptions;
 }
Esempio n. 20
0
    void Start()
    {
        // Drawing tool
        lineRenderer = GetComponent <LineRenderer>();
        // Controllers
        manualInputControl  = GetComponent <ManualInputControl>();
        selectionControl    = GetComponent <SelectionControl>();
        targetControl       = GetComponent <TargetControl>();
        commandControl      = GetComponent <CommandControl>();
        panelControl        = GetComponent <PanelControl>();
        stateMessageControl = GetComponent <StateMessageControl>();
        cameraControl       = GetComponent <CameraControl>();
        backupFileControl   = GetComponent <BackUpFileControl>();
        effectorFileControl = GetComponent <EffectorFileControl>();

        // Initial config
        cameraControl.SetIsProcessing(true);//
        axisCamera.SetActive(true);

        defaultPosition = target.position;
        target.GetComponent <ClampName>().textPanel.gameObject.SetActive(false);
        target.gameObject.SetActive(false);
        SetTarget(null);
        UpdateTargets(targetControl.GetNames());

        // Get commands names
        commandsDropdown.AddOptions(commandControl.GetNames());
        CommandsDropdown_IndexChanged(0);

        byXYZPRDropdown.AddOptions(new List <string>()
        {
            "X", "Y", "Z", "P", "R"
        });

        // Ports list
        portsDropdown.AddOptions(new List <string>(controller.List_Ports()));

        // Scorbot ER IX version list
        scorbotVersionDropdown.AddOptions(new List <string>()
        {
            "Original"
        });
    }
Esempio n. 21
0
    private void GetRackInfo()
    {
        racks       = GameObject.FindGameObjectsWithTag(Tags.rack).OrderBy(go => go.name).ToArray();
        rackWPs     = new Vector3[racks.Length];
        rackScripts = new WeaponRack[racks.Length];
        spawnBoxes  = new BoxCollider[racks.Length][];

        for (int i = 0; i < racks.Length; i++)
        {
            rackScripts[i] = racks[i].GetComponent <WeaponRack>();
            Vector3 rack = racks[i].transform.position;
            UnityEngine.AI.NavMeshHit hit;
            if (UnityEngine.AI.NavMesh.SamplePosition(rack, out hit, 0.5f, UnityEngine.AI.NavMesh.AllAreas))
            {
                rack = hit.position;
            }
            rackWPs[i]    = rack;
            spawnBoxes[i] = rackScripts[i].spawnZone.ToArray();
            TargetControl.Shuffle <BoxCollider> (spawnBoxes[i]);
        }
    }
        private void ToggleItemRowsExpansion(IList itemList, bool expand)
        {
            if (itemList.Count == 0)
            {
                return;
            }

            expandedRowsUpdate = true;

            foreach (object item in itemList)
            {
                int itemIndex = ((IList)TargetControl.ItemsSource).IndexOf(item);
                if (itemIndex != -1)
                {
                    int rowHandle = TargetControl.GetRowHandleByListIndex(itemIndex);
                    TargetControl.SetMasterRowExpanded(rowHandle, expand);
                }
            }

            expandedRowsUpdate = false;
        }
Esempio n. 23
0
        public LiveCapture(Core core, string host, UInt32 remoteIdent, MainWindow main)
        {
            InitializeComponent();

            if (SystemInformation.HighContrast)
            {
                toolStrip1.Renderer = new ToolStripSystemRenderer();
            }

            m_Core = core;
            m_Main = main;

            this.DoubleBuffered = true;
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true);

            Icon = global::renderdocui.Properties.Resources.icon;

            m_Connection  = null;
            m_Host        = host;
            m_RemoteIdent = remoteIdent;

            childProcessLabel.Visible = false;
            childProcesses.Visible    = false;

            m_ConnectThread = null;

            SetText("Connecting...");
            connectionStatus.Text = "Connecting...";
            connectionIcon.Image  = global::renderdocui.Properties.Resources.hourglass;

            thumbs            = new ImageList();
            thumbs.ColorDepth = ColorDepth.Depth24Bit;

            thumbs.ImageSize        = new Size(256, 144);
            captures.TileSize       = new Size(400, 160);
            captures.LargeImageList = thumbs;

            captures.Columns.AddRange(new ColumnHeader[] { new ColumnHeader(), new ColumnHeader(), new ColumnHeader() });
        }
Esempio n. 24
0
        /// <summary>
        /// Appelé une fois que le comportement est attaché à un AssociatedObject.
        /// </summary>
        protected override void OnAttached()
        {
            base.OnAttached();

            if (base.AssociatedObject is ListBox)
            {
                _controlType = TargetControl.ListBox;
            }
            else if (base.AssociatedObject is GanttChartDataGrid)
            {
                _controlType = TargetControl.GanttChartDataGrid;
            }
            else if (base.AssociatedObject is DataGrid)
            {
                _controlType = TargetControl.DataGrid;
            }
            else
            {
                throw new InvalidOperationException("Le type n'est pas supporté");
            }

            base.AssociatedObject.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(AssociatedObject_SelectionChanged);
        }
Esempio n. 25
0
        private void ConnectionThreadEntry()
        {
            try
            {
                string username = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

                m_Connection = StaticExports.CreateTargetControl(m_Host, m_RemoteIdent, username, true);

                if (m_Connection.Connected)
                {
                    string api = "No API detected";
                    if (m_Connection.API.Length > 0)
                    {
                        api = m_Connection.API;
                    }
                    this.BeginInvoke((MethodInvoker) delegate
                    {
                        if (m_Connection.PID == 0)
                        {
                            connectionStatus.Text = String.Format("Connection established to {0} ({1})", m_Connection.Target, api);
                            SetText(String.Format("{0}", m_Connection.Target));
                        }
                        else
                        {
                            connectionStatus.Text = String.Format("Connection established to {0} [PID {1}] ({2})",
                                                                  m_Connection.Target, m_Connection.PID, api);
                            SetText(String.Format("{0} [PID {1}]", m_Connection.Target, m_Connection.PID));
                        }
                        connectionIcon.Image = global::renderdocui.Properties.Resources.connect;
                    });
                }
                else
                {
                    throw new ReplayCreateException(ReplayCreateStatus.NetworkIOFailed);
                }

                while (m_Connection.Connected)
                {
                    m_Connection.ReceiveMessage();

                    if (m_TriggerCapture)
                    {
                        m_Connection.TriggerCapture((uint)m_CaptureNumFrames);
                        m_TriggerCapture = false;
                    }

                    if (m_QueueCapture)
                    {
                        m_Connection.QueueCapture((uint)m_CaptureFrameNum);
                        m_QueueCapture    = false;
                        m_CaptureFrameNum = 0;
                    }

                    if (m_CopyLogLocalPath != "")
                    {
                        m_Connection.CopyCapture(m_CopyLogID, m_CopyLogLocalPath);
                        m_CopyLogLocalPath = "";
                        m_CopyLogID        = uint.MaxValue;
                    }

                    List <uint> dels = new List <uint>();
                    lock (m_DeleteLogs)
                    {
                        dels.AddRange(m_DeleteLogs);
                        m_DeleteLogs.Clear();
                    }

                    foreach (var del in dels)
                    {
                        m_Connection.DeleteCapture(del);
                    }

                    if (m_Disconnect)
                    {
                        m_Connection.Shutdown();
                        m_Connection = null;
                        return;
                    }

                    if (m_Connection.InfoUpdated)
                    {
                        this.BeginInvoke((MethodInvoker) delegate
                        {
                            if (m_Connection.PID == 0)
                            {
                                connectionStatus.Text = String.Format("Connection established to {0} ({1})", m_Connection.Target, m_Connection.API);
                                SetText(String.Format("{0}", m_Connection.Target));
                            }
                            else
                            {
                                connectionStatus.Text = String.Format("Connection established to {0} [PID {1}] ({2})",
                                                                      m_Connection.Target, m_Connection.PID, m_Connection.API);
                                SetText(String.Format("{0} [PID {1}]", m_Connection.Target, m_Connection.PID));
                            }
                            connectionIcon.Image = global::renderdocui.Properties.Resources.connect;
                        });

                        m_Connection.InfoUpdated = false;
                    }

                    if (m_Connection.CaptureExists)
                    {
                        uint     capID     = m_Connection.CaptureFile.ID;
                        DateTime timestamp = new DateTime(1970, 1, 1, 0, 0, 0);
                        timestamp = timestamp.AddSeconds(m_Connection.CaptureFile.timestamp).ToLocalTime();
                        byte[] thumb       = m_Connection.CaptureFile.thumbnail;
                        int    thumbWidth  = m_Connection.CaptureFile.thumbWidth;
                        int    thumbHeight = m_Connection.CaptureFile.thumbHeight;
                        string path        = m_Connection.CaptureFile.path;
                        bool   local       = m_Connection.CaptureFile.local;

                        this.BeginInvoke((MethodInvoker) delegate
                        {
                            CaptureAdded(capID, m_Connection.Target, m_Connection.API, thumb, thumbWidth, thumbHeight, timestamp, path, local);
                        });
                        m_Connection.CaptureExists = false;
                    }

                    if (m_Connection.CaptureCopied)
                    {
                        uint   capID = m_Connection.CaptureFile.ID;
                        string path  = m_Connection.CaptureFile.path;

                        this.BeginInvoke((MethodInvoker) delegate
                        {
                            CaptureCopied(capID, path);
                        });

                        m_Connection.CaptureCopied = false;
                    }

                    if (m_Connection.ChildAdded)
                    {
                        if (m_Connection.NewChild.PID != 0)
                        {
                            try
                            {
                                ChildProcess c = new ChildProcess();
                                c.PID   = (int)m_Connection.NewChild.PID;
                                c.ident = m_Connection.NewChild.ident;
                                c.name  = Process.GetProcessById((int)m_Connection.NewChild.PID).ProcessName;

                                lock (m_Children)
                                {
                                    m_Children.Add(c);
                                }
                            }
                            catch (Exception)
                            {
                                // process expired/doesn't exist anymore
                            }
                        }

                        m_Connection.ChildAdded = false;
                    }
                }

                this.BeginInvoke((MethodInvoker) delegate
                {
                    connectionStatus.Text = "Connection closed";
                    connectionIcon.Image  = global::renderdocui.Properties.Resources.disconnect;

                    numFrames.Enabled          = captureDelay.Enabled = captureFrame.Enabled =
                        triggerCapture.Enabled = queueCap.Enabled = false;

                    ConnectionClosed();
                });
            }
            catch (ReplayCreateException)
            {
                this.BeginInvoke((MethodInvoker) delegate
                {
                    SetText("Connection failed");
                    connectionStatus.Text = "Connection failed";
                    connectionIcon.Image  = global::renderdocui.Properties.Resources.delete;

                    ConnectionClosed();
                });
            }
        }
 public void ResetDirtyFlag()
 {
     ScriptManager.RegisterClientScriptBlock(TargetControl, TargetControl.GetType(),
                                             string.Format("{0}_Values_Update", TargetControl.ClientID), string.Format("document.getElementById(\"{0}\").value = \"{1}\";",
                                                                                                                       string.Format("{0}_Values", TargetControl.ClientID), String.Join(",", GetValuesArray())), true);
 }
Esempio n. 27
0
 void Start()
 {
     mTrackableBehaviour = GetComponent<TrackableBehaviour>();
     if (mTrackableBehaviour)
     {
         mTrackableBehaviour.RegisterTrackableEventHandler(this);
     }
     tc = transform.GetChild(0).gameObject.GetComponent<TargetControl>();
     OnTrackingLost();
 }
Esempio n. 28
0
        public void OnAlignmentPropertyChanged()
        {
            if (_translateTransform == null)
            {
                root.RenderTransform = _translateTransform = new TranslateTransform();
            }
            var targetPos = TargetControl.TransformToVisual((FrameworkElement)Window.Current.Content).TransformPoint(new Point(0, 0));
            var rootPos   = targetPos;

            #region calc pos
            var offsetX = (this.TargetControl.ActualWidth - this.Width) / 2;
            var offsetY = (this.TargetControl.ActualHeight - this.Height) / 2;
            if (this.HorizontalAlignment == HorizontalAlignment.Left && this.VerticalAlignment == VerticalAlignment.Top)
            {
                //rootPos.X += -this.Width;
                rootPos.Y += -this.Height;
            }
            else if (this.HorizontalAlignment == HorizontalAlignment.Left && (this.VerticalAlignment == VerticalAlignment.Center || this.VerticalAlignment == VerticalAlignment.Stretch))
            {
                rootPos.X += -this.Width;
                rootPos.Y += offsetY;
            }
            else if (this.HorizontalAlignment == HorizontalAlignment.Left && this.VerticalAlignment == VerticalAlignment.Bottom)
            {
                //rootPos.X += -this.Width;
                rootPos.Y += this.TargetControl.ActualHeight;
            }


            else if ((this.HorizontalAlignment == HorizontalAlignment.Center || this.HorizontalAlignment == HorizontalAlignment.Stretch) && this.VerticalAlignment == VerticalAlignment.Top)
            {
                rootPos.X += offsetX;
                rootPos.Y += -this.Height;
            }
            else if ((this.HorizontalAlignment == HorizontalAlignment.Center || this.HorizontalAlignment == HorizontalAlignment.Stretch) && (this.VerticalAlignment == VerticalAlignment.Center || this.VerticalAlignment == VerticalAlignment.Stretch))
            {
                rootPos.X += offsetX;
                rootPos.Y += offsetY;
            }
            else if ((this.HorizontalAlignment == HorizontalAlignment.Center || this.HorizontalAlignment == HorizontalAlignment.Stretch) && this.VerticalAlignment == VerticalAlignment.Bottom)
            {
                rootPos.X += offsetX;
                rootPos.Y += this.TargetControl.ActualHeight;
            }

            else if (this.HorizontalAlignment == HorizontalAlignment.Right && this.VerticalAlignment == VerticalAlignment.Top)
            {
                rootPos.X += this.TargetControl.ActualWidth - this.Width;
                rootPos.Y += -this.Height;
            }
            else if (this.HorizontalAlignment == HorizontalAlignment.Right && (this.VerticalAlignment == VerticalAlignment.Center || this.VerticalAlignment == VerticalAlignment.Stretch))
            {
                rootPos.X += this.TargetControl.ActualWidth;
                rootPos.Y += offsetY;
            }
            else if (this.HorizontalAlignment == HorizontalAlignment.Right && this.VerticalAlignment == VerticalAlignment.Bottom)
            {
                rootPos.X += this.TargetControl.ActualWidth - this.Width;
                rootPos.Y += this.TargetControl.ActualHeight;
            }
            #endregion

            _translateTransform.X = rootPos.X;
            _translateTransform.Y = rootPos.Y;
        }
Esempio n. 29
0
        /// <summary>
        /// Called when the content of the target control has changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="Catel.Windows.Data.DependencyPropertyValueChangedEventArgs"/> instance containing the event data.</param>
        private void OnTargetControlContentChanged(object sender, DependencyPropertyValueChangedEventArgs e)
        {
            TargetControl.UnsubscribeFromDependencyProperty("Content", OnTargetControlContentChanged);

            CreateViewModelGrid();
        }
Esempio n. 30
0
        /// <summary>
        /// Subscribes to the parent view model container.
        /// </summary>
        private void SubscribeToParentViewModelContainer()
        {
            if (!SupportParentViewModelContainers)
            {
                return;
            }

            if (HasParentViewModelContainer)
            {
                return;
            }

            _parentViewModelContainer = FindParentByPredicate(TargetControl, o => o is IViewModelContainer) as IViewModelContainer;
            if (_parentViewModelContainer != null)
            {
                Log.Debug("Found the parent view model container '{0}' for '{1}'", _parentViewModelContainer.GetType().Name, TargetControl.GetType().Name);
            }
            else
            {
                Log.Debug("Couldn't find parent view model container");
            }

            if (_parentViewModelContainer != null)
            {
                _parentViewModelContainer.ViewModelChanged += OnParentViewModelContainerViewModelChanged;
                _parentViewModelContainer.ViewLoading      += OnParentViewModelContainerLoading;
                _parentViewModelContainer.ViewUnloading    += OnParentViewModelContainerUnloading;

                SubscribeToParentViewModel(_parentViewModelContainer.ViewModel);
            }
        }
Esempio n. 31
0
        /// <summary>
        /// Called when the <c>DataContext</c> property of the <see cref="TargetControl"/> has changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
        public override void OnTargetControlDataContextChanged(object sender, DependencyPropertyValueChangedEventArgs e)
        {
            // Fix in WinRT to make sure inner grid is created
            if (_viewModelGrid == null)
            {
                if (TargetControl.Content != null)
                {
                    CreateViewModelGrid();
                }
                else
                {
                    Log.Error("Content of control '{0}' is not yet loaded, but the DataContext has changed. The control will bind directly to the DataContext instead of the view model", TargetControl.GetType().FullName);
                }
            }

            // Fix for CTL-307: DataContextChanged is invoked before Unloaded because Parent is set to null
            var targetControlParent = TargetControl.Parent;

            if (targetControlParent == null)
            {
                return;
            }

            base.OnTargetControlDataContextChanged(sender, e);

            var oldDataContext = e.OldValue;
            var dataContext    = e.NewValue;

            if (BindingHelper.IsSentinelObject(dataContext))
            {
                return;
            }

            if (oldDataContext != null)
            {
                ClearWarningsAndErrorsForObject(oldDataContext);
            }

            if (!IsUnloading)
            {
                UpdateDataContextToUseViewModel(dataContext);
            }
        }