Exemplo n.º 1
0
        private void GatherRomsComplete(AsyncTaskData taskData)
        {
            var args           = (RomDiscoveryData)taskData;
            var discoveredRoms = args.NewRoms;
            var addedRoms      = Model.AddNewItemsFromList(discoveredRoms, args.InsertLocation);

            if (addedRoms.Any())
            {
                var collectionChanged = CollectionChanged;
                if (collectionChanged != null)
                {
                    collectionChanged(this, new System.Collections.Specialized.NotifyCollectionChangedEventArgs(System.Collections.Specialized.NotifyCollectionChangedAction.Add, addedRoms as System.Collections.IList));
                }
                if (args.SelectNewRoms)
                {
                    CurrentSelection.Clear();
                    var addedItemIndexes = addedRoms.Select(r => Programs.ModelCollection.IndexOf(r));
                    foreach (var addedRomIndex in addedItemIndexes)
                    {
                        var programViewModel = Programs[addedRomIndex];
                        CurrentSelection.Add(programViewModel);
                    }
                }
                SaveRomList(true);
            }
            Model.EndAddRomsFromFiles(args.DuplicateRomPaths);
            if (taskData.Error != null)
            {
                OSMessageBox.Show(Resources.Strings.AddRomsErrorMessage, Resources.Strings.AddRomsErrorTitle, taskData.Error, null);
            }
        }
Exemplo n.º 2
0
 public LiteItem Next()
 {
     CurrentSelection.RollOff();
     CurrentSelectionIndex++;
     CurrentSelection.RollOver();
     return(CurrentSelection);
 }
Exemplo n.º 3
0
        public virtual ActionResult LogOn()
        {
            CurrentSelection currentSelection = new CurrentSelection();

            currentSelection.CategoriesMenu = hopeLingerieEntities.Categories.Where(x => x.ParentCategoryId == null && x.Active).OrderBy(x => x.DisplayOrder).ToList();
            return(View(currentSelection));
        }
Exemplo n.º 4
0
        private void OnMenuAddProperties(object sender, EventArgs e)
        {
            NodeShape shapeElement = CurrentSelection.OfType <ClassShape>().FirstOrDefault();

            if (shapeElement?.ModelElement is ModelClass element)
            {
                AddCodeForm codeForm = new AddCodeForm(element);
                if (codeForm.ShowDialog() == DialogResult.OK)
                {
                    using (Transaction tx = element.Store.TransactionManager.BeginTransaction("AddProperties"))
                    {
                        element.Attributes.Clear();
                        IEnumerable <ModelAttribute> modelAttributes =
                            codeForm.Lines
                            .Select(s => ModelAttribute.Parse(element.ModelRoot, s))
                            .Where(attr => attr != null)
                            .Select(parseResult => new ModelAttribute(element.Store,
                                                                      new PropertyAssignment(ModelAttribute.NameDomainPropertyId, parseResult.Name),
                                                                      new PropertyAssignment(ModelAttribute.TypeDomainPropertyId, parseResult.Type ?? "String"),
                                                                      new PropertyAssignment(ModelAttribute.RequiredDomainPropertyId, parseResult.Required ?? true),
                                                                      new PropertyAssignment(ModelAttribute.MaxLengthDomainPropertyId, parseResult.MaxLength ?? 0),
                                                                      new PropertyAssignment(ModelAttribute.InitialValueDomainPropertyId, parseResult.InitialValue),
                                                                      new PropertyAssignment(ModelAttribute.IsIdentityDomainPropertyId, parseResult.IsIdentity),
                                                                      new PropertyAssignment(ModelAttribute.SetterVisibilityDomainPropertyId, parseResult.SetterVisibility ?? SetterAccessModifier.Public)
                                                                      ));
                        element.Attributes.AddRange(modelAttributes);
                        tx.Commit();
                    }
                }
            }
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Get a value determining if the new writing systems should be created as a side-effect
        /// of a paste operation.
        /// </summary>
        /// <param name="wsf">writing system factory containing the new writing systems</param>
        /// <param name="destWs">The destination writing system (writing system used at the
        /// selection).</param>
        /// <returns>
        ///     an indication of how the paste should be handled.
        /// </returns>
        /// ------------------------------------------------------------------------------------
        public override PasteStatus DeterminePasteWs(ILgWritingSystemFactory wsf, out int destWs)
        {
            // Determine writing system at selection (destination for paste).
            destWs = 0;
            if (CurrentSelection != null)
            {
                destWs = CurrentSelection.GetWritingSystem(SelectionHelper.SelLimitType.Anchor);
            }
            if (destWs <= 0)
            {
                destWs = Cache.DefaultAnalWs;                 // set to default analysis, if 0.
            }
            int cws = wsf.NumberOfWs;

            using (ArrayPtr ptr = MarshalEx.ArrayToNative <int>(cws))
            {
                wsf.GetWritingSystems(ptr, cws);
                int[] vws = MarshalEx.NativeToArray <int>(ptr, cws);

                for (int iws = 0; iws < cws; iws++)
                {
                    if (vws[iws] != 0 && wsf.get_EngineOrNull(vws[iws]) == null)
                    {
                        // found corrupt writing system--don't want to use any ws in this pasted string
                        return(PasteStatus.UseDestWs);
                    }
                }
            }

            return(PasteStatus.PreserveWs);
        }
Exemplo n.º 6
0
 private void OnStatusHideShape(object sender, EventArgs e)
 {
     if (sender is MenuCommand command)
     {
         command.Visible = command.Enabled = CurrentSelection.OfType <ClassShape>().Any() || CurrentSelection.OfType <EnumShape>().Any();
     }
 }
Exemplo n.º 7
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Go to the previous footnote in the footnote view
        /// </summary>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        public override ScrFootnote GoToPreviousFootnote()
        {
            CheckDisposed();

            // In case no footnote is selected - can happen when footnote pane is first opened.
            if (CurrentSelection == null)
            {
                return(null);
            }

            // Get the information needed from the current selection
            int     iBook     = CurrentSelection.GetLevelInfoForTag(BookFilter.Tag).ihvo;
            int     iFootnote = CurrentSelection.GetLevelInfoForTag((int)ScrBook.ScrBookTags.kflidFootnotes).ihvo;
            ScrBook book      = BookFilter.GetBook(iBook);

            // Get the previous footnote if it exists
            if (--iFootnote < 0)
            {
                return(null);
            }
            ScrFootnote footnote = new ScrFootnote(m_cache, book.FootnotesOS.HvoArray[iFootnote]);

            ScrollToFootnote(iBook, iFootnote, 0);
            return(footnote);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Disconnects everything inside this class
        /// </summary>
        public virtual void Disconnect()
        {
/*			lastItems = null;
 *                      UnsetDragFunctionality();
 *                      onListCellDescription = null;
 *                      if (listadaptor != null) {
 *                              listadaptor.OnListChanged -= DSChanged;
 *                              listadaptor.OnElementAdded -= DSElementAdded;
 *                              listadaptor.OnElementChanged -= DSElementChanged;
 *                              listadaptor.OnElementRemoved -= DSElementRemoved;
 *                              listadaptor.OnTargetChange -= ListTargetChanged;
 *                              listadaptor.Disconnect();
 *                              listadaptor = null;
 *                      }*/
            if (CurrentSelection != null)
            {
                CurrentSelection.Disconnect();
                currentSelection = null;
            }
            if (adaptor != null)
            {
                adaptor.Disconnect();
                adaptor = null;
            }
            internalModel.Disconnect();
            internalModel = null;
//			cachedItems = null;
        }
Exemplo n.º 9
0
        private void OnMenuShowShape(object sender, EventArgs e)
        {
            NodeShape firstShape = CurrentSelection.OfType <NodeShape>().FirstOrDefault();

            if (firstShape != null)
            {
                using (Transaction tx = firstShape.Store.TransactionManager.BeginTransaction("HideShapes"))
                {
                    LinkedElementCollection <ShapeElement> childShapes = CurrentDocView.CurrentDiagram.NavigationRoot.NestedChildShapes;

                    foreach (ClassShape shape in childShapes.OfType <ClassShape>().Where(s => !s.IsVisible))
                    {
                        shape.Visible = true;
                    }

                    foreach (EnumShape shape in childShapes.OfType <EnumShape>().Where(s => !s.IsVisible))
                    {
                        shape.Visible = true;
                    }

                    foreach (ShapeElement shape in childShapes.Where(s => !s.IsVisible))
                    {
                        shape.Show();
                    }

                    tx.Commit();
                }
            }
        }
Exemplo n.º 10
0
        private void ExecuteStartSelectedProgramsDrag(object parameter)
        {
            var itemsToDrag = new List <ProgramDescription>();

            _dragProgramsStartCommand.Programs = itemsToDrag;
            itemsToDrag.AddRange(CurrentSelection.Select(p => p.Model));
        }
Exemplo n.º 11
0
 /// <summary>
 /// Set font default for document
 /// </summary>
 public void SetDefaultFontFormat(int FontSize, bool isBold, bool isItalic)
 {
     CurrentSelection.ClearFormatting();
     CurrentSelection.Font.Name = "Calibri";
     CurrentSelection.Font.Size = FontSize;
     if (isBold)
     {
         CurrentSelection.Font.Bold = 1;
     }
     else
     {
         CurrentSelection.Font.Bold = 0;
     }
     if (isItalic)
     {
         CurrentSelection.Font.Italic = 1;
     }
     else
     {
         CurrentSelection.Font.Italic = 0;
     }
     CurrentSelection.Font.Color = (WdColor)Microsoft.VisualBasic.Information.RGB(0, 0, 128);
     CurrentSelection.ParagraphFormat.LineSpacingRule = WdLineSpacing.wdLineSpaceSingle;
     CurrentSelection.ParagraphFormat.LineSpacing     = 10;
     CurrentSelection.ParagraphFormat.SpaceAfter      = 0;
     CurrentSelection.ParagraphFormat.SpaceBefore     = 0;
 }
Exemplo n.º 12
0
 public LiteItem Prev()
 {
     CurrentSelection.RollOff();
     CurrentSelectionIndex--;
     CurrentSelection.RollOver();
     return(CurrentSelection);
 }
Exemplo n.º 13
0
        private void OnMenuHideShape(object sender, EventArgs e)
        {
            Store store = CurrentSelection.OfType <NodeShape>().FirstOrDefault()?.Store;

            if (store != null)
            {
                using (Transaction tx = store.TransactionManager.BeginTransaction("HideShapes"))
                {
                    foreach (ClassShape shape in CurrentSelection.OfType <ClassShape>())
                    {
                        shape.Visible = false;
                    }

                    foreach (EnumShape shape in CurrentSelection.OfType <EnumShape>())
                    {
                        shape.Visible = false;
                    }

                    foreach (CommentBoxShape shape in CurrentSelection.OfType <CommentBoxShape>())
                    {
                        shape.Visible = false;
                    }

                    tx.Commit();
                }
            }
        }
Exemplo n.º 14
0
        public virtual ActionResult RenderMenu()
        {
            CurrentSelection currentSelection = new CurrentSelection();

            currentSelection.CategoriesMenu = hopeLingerieEntities.Categories.Where(x => x.ParentCategoryId == null && x.Active && x.Enabled).OrderBy(x => x.DisplayOrder).ToList();

            return(PartialView("MenuPartialView", currentSelection));
        }
Exemplo n.º 15
0
 private void OnStatusAddProperties(object sender, EventArgs e)
 {
     if (sender is MenuCommand command)
     {
         command.Visible = true;
         command.Enabled = CurrentSelection.OfType <ClassShape>().Count() == 1;
     }
 }
Exemplo n.º 16
0
 public bool Evaluate(EFileDocument document, int useAtLeast, string xquery, CurrentSelection currentSelection, string ruleText = "", Processor processor = null, XdmNode _XdmNode = null, List <int> fields = null, XQueryExecutable compiledXQueryExecutable = null)
 {
     if (_evaluator == null)
     {
         throw new InvalidOperationException("Rule XML was invalid.");
     }
     return(_evaluator.Evaluate(document, useAtLeast, currentSelection, true, xquery, ruleText, processor, _XdmNode, fields, compiledXQueryExecutable));
 }
Exemplo n.º 17
0
 private void OnStatusAddValues(object sender, EventArgs e)
 {
     if (sender is MenuCommand command)
     {
         command.Visible = CurrentSelection.OfType <EnumShape>().Any() && !CurrentSelection.OfType <ClassShape>().Any();
         command.Enabled = CurrentSelection.OfType <EnumShape>().Count() == 1;
     }
 }
Exemplo n.º 18
0
 private void OnMenuMergeAssociations(object sender, EventArgs e)
 {
     UnidirectionalAssociation[] selected = CurrentSelection.OfType <UnidirectionalConnector>()
                                            .Select(connector => connector.ModelElement)
                                            .Cast <UnidirectionalAssociation>()
                                            .ToArray();
     ((EFModelDocData)CurrentDocData).Merge(selected);
 }
Exemplo n.º 19
0
        private void OnMenuSplitAssociation(object sender, EventArgs e)
        {
            BidirectionalAssociation selected = CurrentSelection.OfType <BidirectionalConnector>()
                                                .Select(connector => connector.ModelElement)
                                                .Cast <BidirectionalAssociation>()
                                                .Single();

            ((EFModelDocData)CurrentDocData).Split(selected);
        }
Exemplo n.º 20
0
 public void Paste()
 {
     try
     {
         CurrentSelection.Paste();
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 21
0
 public void Copy()
 {
     try
     {
         CurrentSelection.Copy();
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 22
0
 public void OnSelectionReleased()
 {
     HandleHovering();
     if (_hoveredElement != null && _hoveredElement.CanReceive(CurrentSelection) &&
         (CurrentSelection.GetTargetType == _hoveredElement.GetElementType ||
          _hoveredElement.GetElementType == ElementType.TrashBin))
     {
         _hoveredElement.Receive(CurrentSelection);
         CurrentSelection.Empty();
     }
 }
Exemplo n.º 23
0
        private void OnStatusRemoveShape(object sender, EventArgs e)
        {
            if (sender is MenuCommand command)
            {
                command.Visible = true;

                // don't check for CommentBoxShape - they can't be removed from the diagram, only deleted
                command.Enabled = CurrentSelection.OfType <ClassShape>().Any() ||
                                  CurrentSelection.OfType <EnumShape>().Any();
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// Selects multiple items.
        /// </summary>
        /// <param name="itemsToSelect">Items to select.</param>
        public void SelectItems(System.Collections.ObjectModel.Collection <ISelectable> itemsToSelect)
        {
            ClearSelection(false);
            foreach (ISelectable item in itemsToSelect)
            {
                CurrentSelection.Add(item);
                item.IsSelected = true;
            }

            Notify();
        }
Exemplo n.º 25
0
        private void OnMenuLayoutDiagram(object sender, EventArgs e)
        {
            EFModelDiagram diagram = CurrentSelection.Cast <EFModelDiagram>().SingleOrDefault();

            if (diagram == null)
            {
                return;
            }

            Commands.LayoutDiagram(diagram);
        }
Exemplo n.º 26
0
 /// <summary>
 /// Delete line
 /// </summary>
 /// <param name="count"></param>
 public void Delete(int count)
 {
     try
     {
         object c     = count;
         object oUnit = Word.WdUnits.wdWord;
         CurrentSelection.Delete(ref oUnit, ref c);
     }
     catch
     {
     }
 }
Exemplo n.º 27
0
 /// <summary>
 /// Write Text In Word Document
 /// </summary>
 public void WriteText(string text, bool writeEnterBeforeText, bool writeEnterAfterText)
 {
     if (writeEnterBeforeText)
     {
         CurrentSelection.TypeParagraph();
     }
     CurrentSelection.TypeText(text);
     if (writeEnterAfterText)
     {
         CurrentSelection.TypeParagraph();
     }
 }
Exemplo n.º 28
0
        private void OnItemCollectionSourceChangedSafe(NotifyCollectionChangedEventArgs e)
        {
            VerifySafe();

            if (e.Action == NotifyCollectionChangedAction.Move)
            {
            }
            else if (e.Action == NotifyCollectionChangedAction.Reset)
            {
                if (SupportsIndex)
                {
                    if (MultipleSelection)
                    {
                        CurrentSelectionCollection.UpdateIndicesSources();
                    }

                    if (CurrentSelectedIndex != -1)
                    {
                        var source = GetSource(CurrentSelectedIndex);

                        Sync(source != null ? CurrentSelection.WithSource(source) : CurrentSelection.WithIndex(-1));
                    }
                }
            }
            else
            {
                if (e.NewItems != null)
                {
                    foreach (var source in e.NewItems)
                    {
                        if (IsSourceSelected(source))
                        {
                            SelectSourceSafe(source);
                        }
                    }
                }

                if (e.OldItems != null)
                {
                    foreach (var source in e.OldItems)
                    {
                        if (IsSourceInSelection(source))
                        {
                            UnselectSourceSafe(source);
                        }
                    }
                }
            }

            SyncIndex(false);
            EnsureSelection();
        }
Exemplo n.º 29
0
        /// <summary>
        /// Removes an item from the selection.
        /// </summary>
        /// <param name="item">Item to be removed from the selection.</param>
        /// <param name="bNotify">True to notify of this selection change. False otherwise.</param>
        public void RemoveFromSelection(ISelectable item, bool bNotify)
        {
            if (ContainsInSelection(item))
            {
                CurrentSelection.Remove(item);
            }
            item.IsSelected = false;

            if (bNotify)
            {
                Notify();
            }
        }
Exemplo n.º 30
0
 private void Control_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button.HasFlag(MouseButtons.Left))
     {
         InitializeSelectionMode();
     }
     else if (e.Button == MouseButtons.Right &&
              CurrentSelection != null &&
              !CurrentSelection.Contains(ActiveGridTile))
     {
         CurrentSelection = null;
     }
 }
Exemplo n.º 31
0
 public void SetCurrent(CurrentSelection current, MotorSelection motors, uint mA, SettingsDuration duration = SettingsDuration.UntilReset)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)current, (byte)motors, (byte)(mA & 0x00FF), (byte)((mA & 0xFF00) >> 8), (byte)duration });
     }
 }