Esempio n. 1
0
        private void HandleMouse()
        {
            if (Input.GetMouseButtonDown(0))
            {
                isMoving = !UIExtensions.IsClickingOverUI(Input.mousePosition, uiMasks);
                if (isMoving)
                {
                    lastObject = FindNearestObject(Input.mousePosition);
                    onMouseDown?.Invoke(Input.mousePosition, lastObject);
                }
            }

            if (Input.GetMouseButton(0) && isMoving)
            {
                onMouseDrag?.Invoke(Input.mousePosition, lastObject);
            }

            if (Input.GetMouseButtonUp(0))
            {
                isMoving = false;
                if (lastObject != null)
                {
                    onMouseUp?.Invoke(Input.mousePosition, lastObject);
                }
            }
        }
Esempio n. 2
0
        public override DragDropEffects DoDragDrop(UIElement source, Point cursorPos)
        {
            this.ThemeItem.Load();
            ImageResourceThemeItem resourceThemeItem = (ImageResourceThemeItem)this.ThemeItem;

            byte[]      numArray    = ((ResourceThemeItem)resourceThemeItem).Save(false);
            IDataObject dataObject1 = Advent.Common.Interop.DataObject.CreateDataObject();
            IDataObject dataObject2 = dataObject1;

            VirtualFile[] virtualFileArray = new VirtualFile[1];
            virtualFileArray[0] = new VirtualFile()
            {
                Name          = this.ThemeItem.Name,
                LastWriteTime = DateTime.Now,
                Contents      = numArray
            };
            VirtualFile[] files = virtualFileArray;
            DataObjectExtensions.SetVirtualFiles(dataObject2, files);
            try
            {
                VmcStudioUtil.DragDropObject = (object)this;
                return(DataObjectExtensions.DoDragDrop(dataObject1, source, UIExtensions.Resize(resourceThemeItem.Image, 100), cursorPos, DragDropEffects.Copy));
            }
            finally
            {
                VmcStudioUtil.DragDropObject = (object)null;
            }
        }
 // Use this for initialization
 void Start()
 {
     Init();
     if (getPadding == GetPadding.LayoutGroup)
     {
         padding = UIExtensions.GetPadding(gameObject);
     }
 }
Esempio n. 4
0
 public override void BindViewHolder(FlexibleAdapter adapter, Java.Lang.Object viewHolder, int position, IList <Java.Lang.Object> payloads)
 {
     if (!(viewHolder is FileEntryViewHolder holder))
     {
         return;
     }
     holder.R.file_cell_title.Text = Title;
     holder.R.file_cell_icon.SetImageDrawable(UIExtensions.GetTintedDrawable(holder.Context, Resource.Drawable.extension, Resource.Color.colorAccent));
     holder.R.file_cell_detail.SetText(Resource.String.web_app);
     holder.R.file_cell_size.Visibility = ViewStates.Gone;
 }
Esempio n. 5
0
        internal void AddWorkspace()
        {
            if (!_isSolutionOpened)
            {
                return;
            }

            var pt = UIExtensions.GetInputWindowCoordinate();

            SelectedWorkspace = Microsoft.VisualBasic.Interaction.InputBox("Enter the name of new Workspace.", "Add Workspace", string.Empty, (int)pt.X, (int)pt.Y);
            SaveWorkspace();
        }
Esempio n. 6
0
        private void GridChanges_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            //XsltTestWindow.ShowDialog(Changes, DiagramOldVersion, DiagramNewVersion);
            DependencyObject source = (DependencyObject)e.OriginalSource;
            DataGridRow      row    = UIExtensions.TryFindParent <DataGridRow>(source);

            //the user did not click on a row
            if (row == null)
            {
                return;
            }

            EvolutionChange change = (EvolutionChange)row.Item;

            DiagramView.SelectElement(change.Element);
            if (change.Element.ExistsInVersion(DiagramOldVersion.Version) && DiagramViewOldVersion != null)
            {
                DiagramViewOldVersion.SelectElement((Element)change.Element.GetInVersion(DiagramOldVersion.Version));
            }

            e.Handled = true;
        }
        public static void ProcessObjectAttributes(List <object> lObjects)
        {
            if (lObjects.Count > 0)
            {
                bool singleSelection = (lObjects.Count == 1);

                foreach (PropertyDescriptor pd in TypeDescriptor.GetProperties(lObjects[0].GetType()))
                {
                    foreach (Attribute attr in pd.Attributes)
                    {
                        if (typeof(SingleSelectionBrowsableAttribute) == attr.GetType())
                        {
                            UIExtensions.SetAttribute(pd.Name, "browsable", typeof(NativeFileInfo), singleSelection);
                        }

                        if (attr is ITranslatableAttribute)
                        {
                            (attr as ITranslatableAttribute).PerformTranslation(pd);
                        }
                    }
                }
            }
        }
Esempio n. 8
0
        private void dataGrid1_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            //search the object hierarchy for a datagrid row
            DependencyObject source = (DependencyObject)e.OriginalSource;
            DataGridRow      row    = UIExtensions.TryFindParent <DataGridRow>(source);

            //the user did not click on a row
            if (row == null)
            {
                return;
            }

            MappingGridItem item = (MappingGridItem)row.Item;

            DiagramView.SelectElement(item.NewVersionConstruct);
            if (DiagramViewOldVersion != null &&
                item.OldVersionConstruct != null && item.OldVersionConstruct is Element)
            {
                DiagramViewOldVersion.SelectElement(item.OldVersionConstruct);
            }

            e.Handled = true;
        }
Esempio n. 9
0
        private void HandleTouch()
        {
            if (Input.touchCount == 1)
            {
                UnityEngine.Touch touch = Input.GetTouch(0);
                switch (touch.phase)
                {
                case TouchPhase.Began:
                    isMoving = !UIExtensions.IsClickingOverUI(touch.position, uiMasks);
                    if (isMoving)
                    {
                        lastObject = FindNearestObject(touch.position);
                        onMouseDown?.Invoke(touch.position, lastObject);
                    }

                    break;

                case TouchPhase.Moved:
                    if (!isMoving)
                    {
                        return;
                    }

                    onMouseDrag?.Invoke(touch.position, lastObject);
                    break;

                case TouchPhase.Ended:
                    isMoving = false;
                    if (lastObject != null)
                    {
                        onMouseUp?.Invoke(touch.position, lastObject);
                    }

                    break;
                }
            }
        }
        private void _ConfigureSettingsFormForANN(BaseSettingsForm oSettingsForm)
        {
            oSettingsForm.MainTableLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            oSettingsForm.MainTableLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
            oSettingsForm.MainTableLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
            {
                oSettingsForm.MainTableLayout.Controls.Add(UIExtensions.LabelWithTextAndName(strings.hiddenCountsLabelText, "hiddenCountsLabel"),
                                                           0, oSettingsForm.MainTableLayout.GetRowHeights().Length);
            }
            {
                TextBox hiddenCountsTextBox = new TextBox();
                hiddenCountsTextBox.Name        = "hiddenCountsTextBox";
                hiddenCountsTextBox.Text        = string.Join(" ", ANNmodelBuilder.kDefaultNeuronsCount.Take(ANNmodelBuilder.kDefaultNeuronsCount.Count() - 1));
                hiddenCountsTextBox.Validating += new System.ComponentModel.CancelEventHandler(_settingsFormHiddenCountsTextBox_Validating);
                hiddenCountsTextBox.Validated  += new EventHandler(_settingsFormHiddenCountsTextBox_Validated);
                oSettingsForm.MainTableLayout.Controls.Add(hiddenCountsTextBox, 1, oSettingsForm.MainTableLayout.GetRowHeights().Length - 1);
            }
            {
                oSettingsForm.MainTableLayout.Controls.Add(UIExtensions.LabelWithTextAndName(strings.activationFuncLabelText, "activationFuncLabel"),
                                                           0, oSettingsForm.MainTableLayout.GetRowHeights().Length);
            }
            {
                ComboBox activationFuncComboBox = new ComboBox();
                activationFuncComboBox.Items.AddRange(ANNmodelBuilder.ActivationFunctionsDict.Keys.ToArray());
                activationFuncComboBox.Text = ANNmodelBuilder.kDefaultActivationFunction;
                activationFuncComboBox.AdjustWidth();
                activationFuncComboBox.AutoCompleteSource    = AutoCompleteSource.ListItems;
                activationFuncComboBox.AutoCompleteMode      = AutoCompleteMode.SuggestAppend;
                activationFuncComboBox.SelectedIndexChanged += new EventHandler(_settingsFormActivationFuncComboBox_SelectedIndexChanged);
                activationFuncComboBox.Name = "activationFuncComboBox";
                oSettingsForm.MainTableLayout.Controls.Add(activationFuncComboBox, 1, oSettingsForm.MainTableLayout.GetRowHeights().Length - 1);
            }

            oSettingsForm.SecondaryTableLayout.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            oSettingsForm.SecondaryTableLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
            oSettingsForm.SecondaryTableLayout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
            {
                oSettingsForm.SecondaryTableLayout.Controls.Add(UIExtensions.LabelWithTextAndName(strings.maxIterationsCountLabelText, "maxIterationsCountLabel"),
                                                                0, oSettingsForm.SecondaryTableLayout.GetRowHeights().Length);
            }
            {
                TextBox maxIterationsCountTextBox = new TextBox();
                maxIterationsCountTextBox.Name        = "hiddenCountsTextBox";
                maxIterationsCountTextBox.Text        = ANNmodelBuilder.kMaxInterationsNum.ToString();
                maxIterationsCountTextBox.Validating += new System.ComponentModel.CancelEventHandler(UIExtensions.uintTextBox_Validating);
                maxIterationsCountTextBox.Validated  += new EventHandler(_settingsFormHiddenCountsTextBox_Validated);
                oSettingsForm.SecondaryTableLayout.Controls.Add(maxIterationsCountTextBox, 1, oSettingsForm.SecondaryTableLayout.GetRowHeights().Length - 1);
            }
            {
                oSettingsForm.SecondaryTableLayout.Controls.Add(UIExtensions.LabelWithTextAndName(strings.stopErrorLabelText,
                                                                                                  "stopErrorLabel"), 0, oSettingsForm.SecondaryTableLayout.GetRowHeights().Length);
            }
            {
                TextBox stopErrorTextBox = new TextBox();
                stopErrorTextBox.Name        = "stopErrorTextBox";
                stopErrorTextBox.Text        = ANNmodelBuilder.kStopError.ToString();
                stopErrorTextBox.Validating += new System.ComponentModel.CancelEventHandler(UIExtensions.doubleTextBox_Validating);
                stopErrorTextBox.Validated  += new EventHandler(_settingsFormStopErrorTextBox_Validated);
                oSettingsForm.SecondaryTableLayout.Controls.Add(stopErrorTextBox, 1, oSettingsForm.SecondaryTableLayout.GetRowHeights().Length - 1);
            }
            oSettingsForm.MainTabControl.Size = new Size(Math.Max(oSettingsForm.MainTableLayout.Size.Width, oSettingsForm.SecondaryTableLayout.Size.Width) + 10,
                                                         Math.Max(oSettingsForm.MainTableLayout.Size.Height, oSettingsForm.SecondaryTableLayout.Size.Height) + 50);
            //TODO: VERY MESSY! CONSIDER CREATING CUSTOM CONTROLS, THAT FIT THE NEEDS!!
        }
Esempio n. 11
0
        private void DataGridCell_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            DataGridCell cell = (DataGridCell)sender;
            CheckBox     cb   = cell.Content as CheckBox;

            if (cb != null)
            {
                if (!cell.IsEditing)
                {
                    try
                    {
                        if (!cell.IsFocused)
                        {
                            cell.Focus();
                        }
                    }
                    catch (Exception)
                    {
                    }

                    DataGrid dataGrid = UIExtensions.FindVisualParent <DataGrid>(cell);
                    if (dataGrid != null)
                    {
                        if (dataGrid.SelectionUnit != DataGridSelectionUnit.FullRow)
                        {
                            if (!cell.IsSelected)
                            {
                                cell.IsSelected = true;
                            }
                        }
                        else
                        {
                            DataGridRow row = UIExtensions.FindVisualParent <DataGridRow>(cell);

                            if (row != null && !row.IsSelected)
                            {
                                row.IsSelected = true;
                            }

                            if (row != null)
                            {
                                cb.IsChecked = cb.IsChecked != false ? false : true;

                                if (row.Item is FakePSMAttribute)
                                {
                                    if (cell.Column.Header.ToString().Contains("Element"))
                                    {
                                        ((FakePSMAttribute)row.Item).XFormElement = cb.IsChecked.Value;
                                    }
                                    else
                                    {
                                        ((FakePSMAttribute)row.Item).Checked = cb.IsChecked.Value;
                                    }
                                }
                                else if (row.Item is FakePSMAssociation)
                                {
                                    ((FakePSMAssociation)row.Item).Checked = cb.IsChecked.Value;
                                }


                                UpdateApplyEnabled();
                            }
                        }
                        dataGrid.SelectedItem = null;
                    }
                }
            }
        }
Esempio n. 12
0
 public static UIColor ToUIColor(string color)
 {
     return(UIExtensions.ToUIColor(color));
 }
Esempio n. 13
0
 public TOut InvokeSyncOnUI <TOut>(Func <CefOverlayForm, TOut> action)
 {
     return(UIExtensions.InvokeSyncOnUI(this, action));
 }
Esempio n. 14
0
 public void InvokeAsyncOnUI(Action <CefOverlayForm> action)
 {
     UIExtensions.InvokeAsyncOnUI(this, action);
 }