コード例 #1
0
        public EntryBlockHolder(EntryBase entryElem, EditorFactory eFactory, Swoosh swooshMgr)
        {
            entryElement  = entryElem;
            editorFactory = eFactory;
            swooshManager = swooshMgr;

            Height = 100;

            lblName          = GlobalLayout.GenMetroLabel(GetNameFromEntry(entryElem));
            lblName.Location = new Point(0, 0);
            lblName.Height   = GlobalLayout.LineHeight;
            btnEdit          = GlobalLayout.GenMetroButton("Edit", Edit_Click);
            btnEdit.Size     = new Size(GlobalLayout.LabelWidth, GlobalLayout.LineHeight);
            btnEdit.Top      = 0;
            Controls.Add(lblName);
            Controls.Add(btnEdit);

            Type editorType = editorFactory.GetEditorTypeByEntry(entryElem);

            isEditorInline = EditorFactory.IsInline(editorType);
            if (isEditorInline)
            {
                displayControl          = (Control)editorFactory.CreateEditorForEntry(entryElem);
                displayControl.Location = new Point(0, GlobalLayout.LineHeight);
                displayControl.Enabled  = false;
            }
            else
            {
                lblLabel       = GlobalLayout.GenMetroLabel(entryElem.Label);
                displayControl = lblLabel;
            }
            Controls.Add(displayControl);
        }
コード例 #2
0
        private void CreateLayout()
        {
            var entrybase = new EntryBase
            {
                Placeholder = "EntryBase",
                Theme       = Naylah.Xamarin.Controls.Style.BasicTheme.Dark
            };

            var textinputlayout = new FloatLabeledEntry
            {
                Placeholder = "FloatLabeledEntry",
                Theme       = Naylah.Xamarin.Controls.Style.BasicTheme.Dark
            };

            Content = new StackLayout
            {
                Padding  = 8,
                Spacing  = 10,
                Children =
                {
                    entrybase,
                    textinputlayout
                }
            };
        }
コード例 #3
0
ファイル: EntryManager.cs プロジェクト: loukylor/VRC-Mods
        public static void OnPlayerJoined(Player player)
        {
            if (player.name.Contains("Local") && player.prop_APIUser_0 == null)
            {
                player.prop_APIUser_0 = APIUser.CurrentUser;
            }

            if (idToEntryTable.ContainsKey(player.prop_APIUser_0.id))
            {
                return; // If already in list
            }
            if (player.name.Contains("Local"))
            {
                if (localPlayerEntry != null)
                {
                    return;
                }

                GameObject template = Object.Instantiate(Constants.playerListLayout.transform.Find("Template").gameObject, Constants.playerListLayout.transform);
                template.SetActive(true);

                LeftSidePlayerEntry leftSidePlayerEntry = EntryBase.CreateInstance <LeftSidePlayerEntry>(template.transform.Find("LeftPart").gameObject);
                EntryBase.CreateInstance <LocalPlayerEntry>(template.transform.Find("RightPart").gameObject);
                AddPlayerLeftPairEntry(EntryBase.CreateInstance <PlayerLeftPairEntry>(template, new object[] { leftSidePlayerEntry, localPlayerEntry }));
            }
            else
            {
                GameObject template = Object.Instantiate(Constants.playerListLayout.transform.Find("Template").gameObject, Constants.playerListLayout.transform);
                template.SetActive(true);

                LeftSidePlayerEntry leftSidePlayerEntry = EntryBase.CreateInstance <LeftSidePlayerEntry>(template.transform.Find("LeftPart").gameObject);
                PlayerEntry         playerEntry         = EntryBase.CreateInstance <PlayerEntry>(template.transform.Find("RightPart").gameObject, new object[] { player });
                AddPlayerLeftPairEntry(EntryBase.CreateInstance <PlayerLeftPairEntry>(template, new object[] { leftSidePlayerEntry, playerEntry }));
            }
        }
コード例 #4
0
ファイル: EntryManager.cs プロジェクト: loukylor/VRC-Mods
 public static void AddEntry(EntryBase entry)
 {
     if (entry.textComponent != null)
     {
         entry.textComponent.fontSize = PlayerListConfig.fontSize.Value;
     }
     entries.Add(entry);
 }
コード例 #5
0
 //custom methods----------------------------------------------------------------
 public virtual void Initialize(EntryBase data)
 {
     if (data == null)
     {
         throw new ArgumentNullException();
     }
     EntryData = data;
 }
コード例 #6
0
        protected internal virtual Tuple <string, Userpic> CreateUserpicTuple(EntryBase e)
        {
            if (e.PosterUserpic != null && !string.IsNullOrWhiteSpace(e.PosterUserpic.Url))
            {
                return(Tuple.Create(e.Poster.Username, e.PosterUserpic));
            }

            return(null);
        }
コード例 #7
0
            public virtual void Write(EntryBase entry)
            {
                if (DataConverter == null)
                {
                    throw new NullReferenceException("DataConverter");
                }
                Trace.WriteLine("DatabaseAdapterBase.Write(EntryBase entry)");

                WriteData(new DataTable().NewRow());
            }
コード例 #8
0
 public EditBookForm(MovieDbContext context, EntryBase entry)
     : base(context)
 {
     InitializeComponent();
     m_entry = entry as BookEntry;
     InitControls();
     m_context.Entry(m_entry).Collection(e => e.Authors).Load();
     InitAuthorList(m_selectedAuthors, m_entry.Authors);
     RefreshAuthorList(authorsListbox, m_selectedAuthors);
 }
コード例 #9
0
        public static NumericEntryBehavior AddNumericEntryBehavior(this EntryBase entry, NumericEntryBehavior numericBehavior = null)
        {
            var b = entry.Behaviors.Where(x => x.GetType() == typeof(NumericEntryBehavior)).FirstOrDefault() as NumericEntryBehavior;

            if (b == null)
            {
                b = numericBehavior ?? new NumericEntryBehavior();
                entry.Behaviors.Add(b);
            }

            return(b);
        }
コード例 #10
0
        public IEditorPanel <EntryBase> CreateEditorForEntry(EntryBase entry)
        {
            if (entry == null)
            {
                throw new ArgumentNullException(nameof(entry));
            }

            Type editorType = GetEditorTypeByEntry(entry);
            var  editor     = (IEditorPanel <EntryBase>)Activator.CreateInstance(editorType, new[] { entry.DataStruct });

            editor.SetPatchData(entry);
            return(editor);
        }
コード例 #11
0
 public static void AddGeneralInfoEntries()
 {
     MelonLogger.Msg("Adding List Entries...");
     AddGeneralInfoEntry(EntryBase.CreateInstance <PlayerListHeaderEntry>(Constants.playerListLayout.transform.Find("Header").gameObject, includeConfig: true));
     AddGeneralInfoEntry(EntryBase.CreateInstance <RoomTimeEntry>(Constants.generalInfoLayout.transform.Find("RoomTime").gameObject, includeConfig: true));
     AddGeneralInfoEntry(EntryBase.CreateInstance <SystemTime12HrEntry>(Constants.generalInfoLayout.transform.Find("SystemTime12Hr").gameObject, includeConfig: true));
     AddGeneralInfoEntry(EntryBase.CreateInstance <SystemTime24HrEntry>(Constants.generalInfoLayout.transform.Find("SystemTime24Hr").gameObject, includeConfig: true));
     AddGeneralInfoEntry(EntryBase.CreateInstance <GameVersionEntry>(Constants.generalInfoLayout.transform.Find("GameVersion").gameObject, includeConfig: true));
     AddGeneralInfoEntry(EntryBase.CreateInstance <CoordinatePositionEntry>(Constants.generalInfoLayout.transform.Find("CoordinatePosition").gameObject, includeConfig: true));
     AddGeneralInfoEntry(EntryBase.CreateInstance <WorldNameEntry>(Constants.generalInfoLayout.transform.Find("WorldName").gameObject, includeConfig: true));
     AddGeneralInfoEntry(EntryBase.CreateInstance <WorldAuthorEntry>(Constants.generalInfoLayout.transform.Find("WorldAuthor").gameObject, includeConfig: true));
     AddGeneralInfoEntry(EntryBase.CreateInstance <InstanceMasterEntry>(Constants.generalInfoLayout.transform.Find("InstanceMaster").gameObject, includeConfig: true));
     AddGeneralInfoEntry(EntryBase.CreateInstance <InstanceCreatorEntry>(Constants.generalInfoLayout.transform.Find("InstanceCreator").gameObject, includeConfig: true));
 }
コード例 #12
0
    public override void Initialize(EntryBase data)
    {
        base.Initialize(data);
        var temp = (data as Entry_ComponentsEntryTemplate);

        _componentsWindow = (Window_Entry_Components)temp.TemplateInstance.GetNewWindow();
        _componentsWindow.Initialize(temp.TemplateInstance);
        _componentsWindow.ComponentsReorderableList.Callback_Draw_Element = CallbackDrawElement;
        foreach (var templateInstanceComponet in temp.TemplateInstance.Componets)
        {
            templateInstanceComponet.OnEditModeModified += Repaint;
            templateInstanceComponet.OnViewModeModified += Repaint;
        }
    }
コード例 #13
0
ファイル: Page1.cs プロジェクト: wdcossey/DevZH.UI
        private void InitializeComponent()
        {
            _container = new VerticalBox();
            this.Child = _container;

            _entry              = new Entry();
            _entry.TextChanged += (sender, args) =>
            {
                Console.WriteLine("onChanged()");
            };
            _container.Children.Add(_entry);

            _form                   = new Form();
            _entryBase              = new PasswordEntry();
            _entryBase.TextChanged += (sender, args) =>
            {
                EntryChanged("password", args.Text);
            };
            _form.Children.Add("Password Entry", _entryBase);

            _entryBase              = new SearchEntry();
            _entryBase.TextChanged += (sender, args) =>
            {
                EntryChanged("search", args.Text);
            };
            _form.Children.Add("Search Box", _entryBase);
            _container.Children.Add(_form, false);

            _group = new Group("Font Families");
            _container.Children.Add(_group, true);
            _vBox           = new VerticalBox();
            _group.Child    = _vBox;
            _multilineEntry = new MultilineEntry();
            _vBox.Children.Add(_multilineEntry, true);

            _button        = new Button("List Font Families");
            _button.Click += (sender, args) =>
            {
                _multilineEntry.Text = "";
                var fonts = new FontFamilies();
                var num   = fonts.Count;
                for (int i = 0; i < num; i++)
                {
                    var value = fonts[i];
                    _multilineEntry.Append(value + "\n");
                }
                fonts.Free();
            };
            _vBox.Children.Add(_button);
        }
コード例 #14
0
 public EntryListViewItem(EntryBase entry)
     : base(entry.Name)
 {
     m_entry = entry;
     SubItems.Add(Constants.GetEntryTypeString(entry.Type));
     if (entry.PublicationYear == null)
     {
         SubItems.Add("");
     }
     else
     {
         SubItems.Add(entry.PublicationYear);
     }
 }
コード例 #15
0
        protected internal virtual IEnumerable <string> EnumerateFiles(EntryBase e)
        {
            if (e.Text == null)
            {
                yield break;
            }

            string[] urls;

            urls = _fileExtractor.GetImagesURLs(e.Text);
            foreach (string url in urls)
            {
                yield return(url);
            }
        }
コード例 #16
0
ファイル: EditorBase.cs プロジェクト: snowdream1985/ILPatcher
        public void SetPatchData(EntryBase pPatchAction)
        {
            if (pPatchAction == null)
            {
                throw new ArgumentNullException(nameof(pPatchAction));
            }
            var tmp = pPatchAction as TSpec;

            if (tmp == null)
            {
                throw new InvalidOperationException("The passed parameter is not designed for this interface element");
            }
            myData = tmp;
            OnPatchDataSet();
        }
コード例 #17
0
        public static void FillMinMax(TableValues <byte, float> table, EntryBase entry)
        {
            float min = table.converter((byte)table.RawMin);
            float max = table.converter((byte)table.RawMax);

            if (entry.Lower_lim != 0)
            {
                min = (float)entry.Lower_lim;
            }
            if (entry.Upper_lim != 0)
            {
                max = (float)entry.Upper_lim;
            }
            table.Min = min;
            table.Max = max;
        }
コード例 #18
0
        /// <summary>
        /// mark blog/news as read, and save the status
        /// </summary>
        /// <param name="entry"></param>
        public static void AsRead(this EntryBase entry)
        {
            if (entry != null && !entry.Status.HasFlag(PostStatus.Read))
            {
                entry.Status &= ~PostStatus.None;
                entry.Status |= PostStatus.Read;

                if (entry is Post)
                {
                    CNBlogSettings.Instance.SaveBlogStatus(entry as Post);
                }
                else if (entry is News)
                {
                    CNBlogSettings.Instance.SaveNewsStatus(entry as News);
                }
            }
        }
コード例 #19
0
        private static string GetNameFromEntry(EntryBase element)
        {
            string typeName;

            switch (element.EntryKind)
            {
            case EntryKind.PatchAction: typeName = ((Data.Actions.PatchAction)element).PatchActionType.ToString(); break;

            case EntryKind.TargetFinder: typeName = ((Data.Finder.TargetFinder)element).TargetFinderType.ToString(); break;

            default:
            case EntryKind.Unknown:
                typeName = "<?>";
                break;
            }
            return($"({typeName}) {element.Name}");
        }
コード例 #20
0
        public EditMovieForm(MovieDbContext context, EntryBase entry)
            : base(context)
        {
            m_entry = entry as MovieEntry;

            InitializeComponent();

            InitControls();

            m_context.Entry(m_entry).Collection(e => e.Directors).Load();
            m_context.Entry(m_entry).Collection(e => e.Actors).Load();

            InitAuthorList(m_selectedDirectors, m_entry.Directors);
            InitAuthorList(m_selectedActors, m_entry.Actors);

            RefreshAuthorList(actorsListbox, m_selectedActors);
            RefreshAuthorList(directorsListbox, m_selectedDirectors);
        }
コード例 #21
0
ファイル: MenuManager.cs プロジェクト: loukylor/VRC-Mods
        public static void CreateGeneralInfoSubMenus()
        {
            // Create Toggle Button Submenus (done automatically to enable expandability)
            int totalMade = 0;

            for (int i = 0; i < Math.Ceiling(EntryManager.generalInfoEntries.Count / 9f); i++)
            {
                SubMenu subMenu = new SubMenu("UserInterface/QuickMenu", $"PlayerListMenuPage{i + 5}");

                for (; totalMade < (9 * (i + 1)) && totalMade < EntryManager.generalInfoEntries.Count; totalMade++)
                {
                    EntryBase    entry  = EntryManager.generalInfoEntries.ElementAt(totalMade);
                    ToggleButton toggle = new ToggleButton(subMenu.gameObject, new Vector3((totalMade % 3) + 1, (float)Math.Floor((totalMade - (9 * i)) / 3f)), $"Enable {entry.Name}", $"Disabled", new Action <bool>((state) => { entry.gameObject.SetActive(state); entry.prefEntry.Value = state; }), $"Toggle the {entry.Name} entry", $"Toggle the {entry.Name} entry", $"{entry.Name.Replace(" ", "")}EntryToggle", entry.prefEntry.Value, true);
                }

                playerListMenus.Add(subMenu);
            }
        }
コード例 #22
0
        public Type GetEditorTypeByEntry(EntryBase entry)
        {
            if (entry == null)
            {
                throw new ArgumentNullException(nameof(entry));
            }

            Type editorType;

            if (dataToEditorMap.TryGetValue(entry.GetType(), out editorType))
            {
                return(editorType);
            }
            else
            {
                Log.Write(Log.Level.Warning, "There is no editor registered for this entry.");
                return(null);
            }
        }
コード例 #23
0
        public static void OnPlayerJoin(Player player)
        {
            if (playerEntries.ContainsKey(player.field_Private_APIUser_0.id))
            {
                return;
            }

            if (player.field_Private_APIUser_0.IsSelf)
            {
                if (localPlayerEntry != null)
                {
                    return;
                }

                localPlayerEntry = EntryBase.CreateInstance <LocalPlayerEntry>(Object.Instantiate(Constants.playerListLayout.transform.Find("Template").gameObject, Constants.playerListLayout.transform));
                AddEntry(localPlayerEntry);
                localPlayerEntry.gameObject.SetActive(true);
                return;
            }

            AddPlayerEntry(EntryBase.CreateInstance <PlayerEntry>(Object.Instantiate(Constants.playerListLayout.transform.Find("Template").gameObject, Constants.playerListLayout.transform), new object[] { player }));
        }
コード例 #24
0
        public bool UpdateWith(EntryBase target, EntryBase source)
        {
            if (source == null || target == null)
            {
                throw new ArgumentNullException();
            }

            if (target.Id != 0 && target.Id != source.Id)
            {
                throw new ArgumentException("Ids should match.");
            }

            bool updated = false;

            updated |= UpdateStringProperty(source.Text, target.Text, s => target.Text = s);
            updated |= UpdateStringProperty(source.Subject, target.Subject, s => target.Subject = s);
            updated |= UpdateStringProperty(source.Url, target.Url, s => target.Url = s);

            if (string.IsNullOrEmpty(target.Poster.Username) && source.Poster != null &&
                !string.IsNullOrEmpty(source.Poster.Username))
            {
                target.Poster = source.Poster;
                updated       = true;
            }

            if (!target.PosterUserpicSpecified && source.PosterUserpicSpecified)
            {
                target.PosterUserpic = source.PosterUserpic;
                updated = true;
            }

            if (target.Date == null && source.Date != null)
            {
                target.Date = source.Date;
                updated     = true;
            }

            return(updated);
        }
コード例 #25
0
        private static Func <byte, float> Source2Value(EntryBase entry)
        {
            var convertInfo = entry.Convert;

            switch (entry.Const_type)
            {
            case 0:
                return(source => (float)Math.Round((convertInfo.Inverted == 0.0
                                                             ? (source - convertInfo.Offset1) * convertInfo.Step / convertInfo.Div_step -
                                                    convertInfo.Offset2
                                                             : convertInfo.Inverted / (source * convertInfo.Div_step)), 2, MidpointRounding.AwayFromZero));

            case 1:
                return(source => (float)Math.Round((convertInfo.Inverted == 0.0
                                                            ? ((sbyte)source - convertInfo.Offset1) * convertInfo.Step / convertInfo.Div_step -
                                                    convertInfo.Offset2
                                                            : convertInfo.Inverted / ((sbyte)source * convertInfo.Div_step)), 2, MidpointRounding.AwayFromZero));

            default:
                throw new NotSupportedException();
            }
        }
コード例 #26
0
ファイル: EFUtil.cs プロジェクト: edobnet/testCore
 public static EntryBase SetInitDefault(this EntryBase entry)
 {
     entry.CreateTime = DateTime.Now;
     entry.UpdateTime = DateTime.Now;
     return(entry);
 }
コード例 #27
0
 void initializeEntry()
 {
     entry = EntryBase.CreateInstance <Entry_ComponentsEntryTemplate>();
 }
コード例 #28
0
 public virtual DataRow ToDataRow(EntryBase entry)
 {
     Trace.WriteLine("IEntryDataConverter  ConverterBase.ToDataRow(EntryBase entry)");
     return(null);
 }
コード例 #29
0
 public static NumericEntryBehavior GetNumericEntryBehavior(this EntryBase entry)
 {
     return(entry.Behaviors.Where(x => x.GetType() == typeof(NumericEntryBehavior)).FirstOrDefault() as NumericEntryBehavior);
 }
コード例 #30
0
 public virtual bool IsDuplicate(ActivityEntry entry)
 {
     return(Author.Equals(entry.Author) && EntryBase.Equals(entry.EntryBase));
 }