Esempio n. 1
0
        public override VmChannelListItem TranslateEntityToVm(ServiceChannelVersioned entity)
        {
            var definition = CreateEntityViewModelDefinition <VmChannelListItem>(entity)
                             .AddNavigation(i => VersioningManager.ApplyLanguageFilterFallback(i.ServiceChannelNames.Where(k => k.TypeId == typesCache.Get <NameType>(NameTypeEnum.Name.ToString())), RequestLanguageId)?.Name ?? "N/A", o => o.Name)
                             //.AddPartial(i => i.Type, o => o as IVmEntityType)
                             .AddSimple(i => EntityTypeEnum.Channel, o => o.MainEntityType)
                             .AddNavigation(i => typesCache.GetByValue <ServiceChannelType>(i.TypeId), o => o.SubEntityType)
                             .AddSimple(i => i.TypeId, o => o.TypeId)
                             .AddSimple(i => i.UnificRootId, o => o.UnificRootId)
                             .AddSimple(i => i.PublishingStatusId, o => o.PublishingStatusId)
                             .AddLocalizable(i => i.Phones.Select(x => x.Phone), o => o.PhoneNumber)
                             .AddLocalizable(i => i.PrintableFormChannels?.FirstOrDefault()?.FormIdentifiers, o => o.FormIdentifier)
                             .AddSimple(i => i.Modified, o => o.Modified)
                             .AddSimple(i => i.Id, o => o.Id)
                             .AddSimple(i => i.UnificRootId, o => o.RootId)
                             .AddCollection <ILanguageAvailability, VmLanguageAvailabilityInfo>(i => i.LanguageAvailabilities.OrderBy(x => languageOrderCache.Get(x.LanguageId)), o => o.LanguagesAvailabilities)
                             .AddNavigation(i => i.Versioning, o => o.Version)
                             .AddSimple(i => i.OrganizationId, o => o.OrganizationId);

            if (entity.UnificRoot != null)
            {
                definition.AddSimple(i => i.UnificRoot.ServiceServiceChannels.Count(
                                         x => x.Service.Versions.Any(y => y.PublishingStatusId != typesCache.Get <PublishingStatusType>(PublishingStatus.Deleted.ToString()))), o => o.ConnectedServices);
            }

            var phone = definition.GetFinal();

            if (phone.PhoneNumber == null)
            {
                definition.AddNavigation(i => i.Phones.Select(x => x.Phone).FirstOrDefault(), o => o.PhoneNumber);
            }

            return(phone);
        }
Esempio n. 2
0
        public override VmChannelConnectionOutput TranslateEntityToVm(ServiceServiceChannel entity)
        {
            var service       = VersioningManager.ApplyPublishingStatusFilterFallback(entity.Service.Versions);
            var serviceTypeId = service.StatutoryServiceGeneralDescriptionId.IsAssigned()
                ? VersioningManager.ApplyPublishingStatusFilterFallback(service.StatutoryServiceGeneralDescription.Versions).TypeId
                : service.TypeId;
            var connectionId = entity.ServiceId.ToString() + service.UnificRootId.ToString();

            return(CreateEntityViewModelDefinition(entity)
                   .AddNavigation(i => connectionId, o => o.ConnectionId)
                   .AddSimple(i => service.Id, o => o.Id)
                   .AddSimple(i => service.UnificRootId, o => o.UnificRootId)
                   .AddCollection <ILanguageAvailability, VmLanguageAvailabilityInfo>(i => service.LanguageAvailabilities, o => o.LanguagesAvailabilities)
                   .AddSimple(i => serviceTypeId.Value, o => o.ServiceTypeId)
                   .AddNavigation(i => typesCache.GetByValue <ServiceType>(serviceTypeId.Value), o => o.ServiceType)
                   .AddSimple(i => service.OrganizationId, o => o.OrganizationId)
                   .AddSimple(i => i.Modified, o => o.Modified)
                   .AddNavigation(i => i.ModifiedBy, o => o.ModifiedBy)
                   .AddDictionary(i => service.ServiceNames.Where(j => j.TypeId == typesCache.Get <NameType>(NameTypeEnum.Name.ToString())), o => o.Name,
                                  i => languageCache.GetByValueEnum(i.LocalizationId).ToString())
                   .AddNavigation(i => i, o => o.BasicInformation)
                   .AddNavigation(i => i, o => o.DigitalAuthorization)
                   .AddNavigation(i => i, o => o.AstiDetails)
                   .GetFinal());
        }
Esempio n. 3
0
        private void Enabled_Click(object sender, EventArgs e)
        {
            ExtendedControls.CheckBoxCustom cb = sender as ExtendedControls.CheckBoxCustom;
            Group g = cb.Tag as Group;

            VersioningManager.SetEnableFlag(g.di, cb.Checked, EDDOptions.Instance.AppDataDirectory);
            changelist[g.di.itemname] = cb.Checked ? "+" : "-";
        }
 public override VmChannelRelationListItem TranslateEntityToVm(ServiceServiceChannel entity)
 {
     return(CreateEntityViewModelDefinition <VmChannelRelationListItem>(entity)
            .AddNavigation(i => Guid.NewGuid().ToString(), o => o.Id)
            .AddSimple(i => i.ServiceId, o => o.Service)
            .AddNavigation(i => VersioningManager.ApplyPublishingStatusFilterFallback(i.ServiceChannel.Versions), o => o.ConnectedChannel)
            .GetFinal());
 }
Esempio n. 5
0
        public object Post([FromBody] VersionedObject value)
        {
            var data = VersioningManager.UnpackVersionedData(value);

            // Do something

            return(data);
        }
        static public void ReadLocalFiles(VersioningManager mgr, bool othertypes)
        {
            mgr.ReadLocalFiles(EDDOptions.Instance.AppDataDirectory, "Actions", "*.act", "Action File");

            if (othertypes)
            {
                mgr.ReadLocalFiles(EDDOptions.Instance.AppDataDirectory, "AddonFiles", "*.inf", "Other Files");
            }
        }
Esempio n. 7
0
 public override VmConnection TranslateEntityToVm(ServiceServiceChannel entity)
 {
     return(CreateEntityViewModelDefinition(entity)
            .AddNavigation(i => i.ServiceChannelId.ToString() + i.ServiceId.ToString(), o => o.Id)
            .AddSimple(i => entity.RequestedForServiceChannel ?? VersioningManager.ApplyPublishingStatusFilterFallback(i.ServiceChannel.Versions)?.Id ?? Guid.Empty, o => o.ChannelId)
            .AddSimple(i => VersioningManager.ApplyPublishingStatusFilterFallback(i.Service.Versions)?.Id ?? Guid.Empty, o => o.ServiceId)
            .AddSimple(i => i.Modified, o => o.Modified)
            .AddNavigation(i => i.ModifiedBy, o => o.ModifiedBy)
            .GetFinal());
 }
Esempio n. 8
0
        private void Deletebutton_Click(object sender, EventArgs e)
        {
            ExtendedControls.ButtonExt cb = sender as ExtendedControls.ButtonExt;
            Group g = cb.Tag as Group;

            if (ExtendedControls.MessageBoxTheme.Show(this, "Do you really want to delete " + g.di.itemname, "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
            {
                VersioningManager.DeleteInstall(g.di, EDDOptions.Instance.AppDataDirectory);
                ReadyToDisplay();
                changelist[g.di.itemname] = "-";
            }
        }
Esempio n. 9
0
 public override VmConnectedChannel TranslateEntityToVm(ServiceChannelVersioned entity)
 {
     return(CreateEntityViewModelDefinition <VmConnectedChannel>(entity)
            .AddSimple(i => i.Id, o => o.Id)
            .AddSimple(i => i.UnificRootId, o => o.RootId)
            .AddNavigation(i => VersioningManager.ApplyLanguageFilterFallback(i.ServiceChannelNames.Where(k => k.TypeId == typesCache.Get <NameType>(NameTypeEnum.Name.ToString())), RequestLanguageId)?.Name ?? "N/A", o => o.Name)
            .AddNavigation(i => i.Type as TypeBase, o => o.Type)
            .AddSimple(i => i.TypeId, o => o.TypeId)
            .AddSimple(i => i.PublishingStatusId, o => o.PublishingStatusId)
            .AddCollection <ILanguageAvailability, VmLanguageAvailabilityInfo>(i => i.LanguageAvailabilities.OrderBy(x => x.Language.OrderNumber), o => o.LanguagesAvailabilities)
            .GetFinal());
 }
Esempio n. 10
0
        private void Deletebutton_Click(object sender, EventArgs e)
        {
            ExtendedControls.ExtButton cb = sender as ExtendedControls.ExtButton;
            Group g = cb.Tag as Group;

            if (ExtendedControls.MessageBoxTheme.Show(this, string.Format("Do you really want to delete {0}".T(EDTx.AddOnManagerForm_DeleteWarn), g.di.itemname), "Warning".T(EDTx.Warning), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
            {
                VersioningManager.DeleteInstall(g.di, EDDOptions.Instance.AppDataDirectory, EDDOptions.Instance.TempMoveDirectory());
                changelist[g.di.itemname] = "-";
                ReadyToDisplay();
            }
        }
 public override VmGeneralDescription TranslateEntityToVm(StatutoryServiceGeneralDescription entity)
 {
     if (entity == null)
     {
         return(null);
     }
     SetLanguage(LanguageCode.fi);
     return(CreateEntityViewModelDefinition(entity)
            .AddPartial(i => VersioningManager.ApplyPublishingStatusFilterFallback(i.Versions))
            .AddSimple(i => i.Id, o => o.Id)
            .GetFinal());
 }
        public override VmServiceRelationListItem TranslateEntityToVm(ServiceVersioned entity)
        {
            var langAvailabilities = entity.LanguageAvailabilities ?? new List <ServiceLanguageAvailability>();

            langAvailabilities = langAvailabilities.Where(i => i.Language != null).ToList();
            return(CreateEntityViewModelDefinition <VmServiceRelationListItem>(entity)
                   .AddNavigation(i => VersioningManager.ApplyLanguageFilterFallback(i.ServiceNames.Where(k => k.TypeId == typesCache.Get <NameType>(NameTypeEnum.Name.ToString())), RequestLanguageId)?.Name ?? "N/A", o => o.Name)
                   .AddSimple(i => i.PublishingStatusId, o => o.PublishingStatusId)
                   .AddSimple(i => i.UnificRootId, o => o.UnificRootId)
                   .AddCollection(i => i.UnificRoot.ServiceServiceChannels.Where(x => VersioningManager.ApplyPublishingStatusFilterFallback(x.ServiceChannel.Versions) != null), o => o.ChannelRelations)
                   .AddCollection <ILanguageAvailability, VmLanguageAvailabilityInfo>(i => langAvailabilities.OrderBy(x => x.Language.OrderNumber), o => o.LanguagesAvailabilities)
                   .GetFinal());
        }
        public override VmServiceListItem TranslateEntityToVm(ServiceVersioned entity)
        {
            var definition = CreateEntityViewModelDefinition <VmServiceListItem>(entity)
                             .AddNavigation(i => VersioningManager.ApplyLanguageFilterFallback(i.ServiceNames.Where(k => k.TypeId == typesCache.Get <NameType>(NameTypeEnum.Name.ToString())), RequestLanguageId)?.Name ?? "N/A", o => o.Name)
                             .AddSimple(i => i.PublishingStatusId, o => o.PublishingStatusId)
                             .AddSimple(i => i.UnificRootId, o => o.UnificRootId)
                             .AddSimple(i => i.TypeId ?? VersioningManager.ApplyPublishingStatusFilterFallback(i.StatutoryServiceGeneralDescription?.Versions).TypeId, o => o.ServiceTypeId)
                             .AddNavigation(
                i =>
                typesCache.GetByValue <ServiceType>(i.TypeId ?? VersioningManager.ApplyPublishingStatusFilterFallback(i.StatutoryServiceGeneralDescription?.Versions).TypeId),
                o => o.ServiceType)
                             .AddCollection(i =>
                                            (VersioningManager.ApplyPublishingStatusFilterFallback(i.StatutoryServiceGeneralDescription?.Versions) != null
                            ? i.ServiceOntologyTerms.Select(x => x.OntologyTerm)
                                             .Union(
                                                 VersioningManager.ApplyPublishingStatusFilterFallback(i.StatutoryServiceGeneralDescription?.Versions).OntologyTerms.Select(x => x.OntologyTerm))
                            : i.ServiceOntologyTerms.Select(x => x.OntologyTerm)).Cast <IFintoItemBase>()
                                            , o => o.OntologyTerms)
                             .AddSimple(i => i.Modified, o => o.Modified)
                             .AddSimpleList(i =>
                                            VersioningManager.ApplyPublishingStatusFilterFallback(i.StatutoryServiceGeneralDescription?.Versions) != null
                            ? i.ServiceServiceClasses.Select(s => s.ServiceClassId)
                                            .Union(
                                                VersioningManager.ApplyPublishingStatusFilterFallback(i.StatutoryServiceGeneralDescription?.Versions)
                                                .ServiceClasses.Select(s => s.ServiceClassId))
                            : i.ServiceServiceClasses.Select(s => s.ServiceClassId)
                                            , o => o.ServiceClasses)
                             .AddCollection <ILanguageAvailability, VmLanguageAvailabilityInfo>(i => i.LanguageAvailabilities.OrderBy(x => x.Language.OrderNumber), o => o.LanguagesAvailabilities)
                             .AddNavigation(i => i.Versioning, o => o.Version)
                             .AddSimpleList(i => i.OrganizationServices.Select(x => x.OrganizationId).Union(new List <Guid> {
                i.OrganizationId
            }), o => o.Organizations)
                             .AddSimpleList(i => i.ServiceProducers.Select(x => x.Id), o => o.Producers);

            if (entity.UnificRoot != null)
            {
                definition.AddSimple(i => i.UnificRoot.ServiceServiceChannels.Count(
                                         x => x.ServiceChannel.Versions.Any(j => j.PublishingStatusId == typesCache.Get <PublishingStatusType>(PublishingStatus.Published.ToString()) ||
                                                                            j.PublishingStatusId == typesCache.Get <PublishingStatusType>(PublishingStatus.Draft.ToString()))),
                                     o => o.ConnectedChannelsCount);
            }

            var model = definition.GetFinal();

            if (!model.Name.Any())
            {
                definition.AddDictionary(i => i.ServiceNames, o => o.Name, k => languageCache.GetByValue(k.LocalizationId));
            }

            return(model);
        }
        private string GetParentName(OrganizationVersioned organizationVersioned)
        {
            if (organizationVersioned?.Parent == null)
            {
                return(string.Empty);
            }
            var parentOrg = VersioningManager.ApplyPublishingStatusFilter(organizationVersioned?.Parent.Versions).FirstOrDefault();

            if (parentOrg == null)
            {
                return(string.Empty);
            }
            return(languageCache.Filter(parentOrg.OrganizationNames.Where(name => name.TypeId == parentOrg.OrganizationDisplayNameTypes.FirstOrDefault(type => type.LocalizationId == name.LocalizationId)?.DisplayNameTypeId), RequestLanguageCode)?.Name ?? string.Empty);
        }
        public override VmChannelRelation TranslateEntityToVm(ServiceServiceChannel entity)
        {
            var model = CreateEntityViewModelDefinition <VmChannelRelation>(entity)
                        .AddSimple(i => i.ServiceId, o => o.Service)
                        .AddSimple(i => i.ChargeTypeId, o => o.ChargeType)
                        .AddSimple(i => true, o => o.isLoaded)
                        .AddCollection(i => i.ServiceServiceChannelDigitalAuthorizations.Select(x => x.DigitalAuthorization as IFintoItemBase), output => output.DigitalAuthorizations)
                        .AddNavigation(i => VersioningManager.ApplyPublishingStatusFilterFallback(i.ServiceChannel.Versions), o => o.ConnectedChannel)
//                .AddLocalizable(i => GetDescription(i), output => output.Description)
//                .AddLocalizable(i => GetDescription(i), output => output.ChargeTypeAdditionalInformation)
                        .GetFinal();

            model.Texts = GetDescriptions(entity);
            return(model);
        }
Esempio n. 16
0
        private void Enabled_Click(object sender, EventArgs e)
        {
            ExtendedControls.ExtCheckBox cb = sender as ExtendedControls.ExtCheckBox;
            Group g = cb.Tag as Group;

            VersioningManager.SetEnableFlag(g.di, cb.Checked, EDDOptions.Instance.AppDataDirectory);

            if (g.di.localenable == cb.Checked)
            {
                changelist.Remove(g.di.itemname);
            }
            else
            {
                changelist[g.di.itemname] = cb.Checked ? "+" : "-";
            }
        }
Esempio n. 17
0
 public override VmChannelListItem TranslateEntityToVm(ServiceServiceChannel entity)
 {
     return(CreateEntityViewModelDefinition <VmChannelListItem>(entity)
            .AddNavigation(input => VersioningManager.ApplyPublishingStatusFilterFallback(input.ServiceChannel.Versions), output => output)
            .GetFinal());
 }
Esempio n. 18
0
        void ReadyToDisplay()
        {
            panelVScroll.RemoveAllControls(new List <Control>()
            {
                buttonMore
            });

            mgr = new VersioningManager();

            int[] edversion = System.Reflection.Assembly.GetExecutingAssembly().GetVersion();
            System.Diagnostics.Debug.Assert(edversion != null);

            mgr.ReadLocalFiles(EDDOptions.Instance.AppDataDirectory, "Actions", "*.act", "Action File");

            if (managedownloadmode)
            {
                mgr.ReadLocalFiles(EDDOptions.Instance.AppDataDirectory, "Flights", "*.vid", "Video File");
                mgr.ReadLocalFiles(EDDOptions.Instance.AppDataDirectory, "AddonFiles", "*.inf", "Other Files");

                mgr.ReadInstallFiles(EDDiscovery.Properties.Resources.URLGithubDataDownload, "ActionFiles/V1", downloadactfolder, EDDOptions.Instance.AppDataDirectory, "*.act", edversion, "Action File");
                mgr.ReadInstallFiles(EDDiscovery.Properties.Resources.URLGithubDataDownload, "VideoFiles/V1", downloadflightfolder, EDDOptions.Instance.AppDataDirectory, "*.vid", edversion, "Video File");
                mgr.ReadInstallFiles(EDDiscovery.Properties.Resources.URLGithubDataDownload, "AddonFiles/V1", downloadaddonfolder, EDDOptions.Instance.AppDataDirectory, "*.inf", edversion, "Other File");

#if DEBUG
                mgr.ReadInstallFiles(EDDiscovery.Properties.Resources.URLGithubDataDownload, "ActionFiles/Debug", downloadactdebugfolder, EDDOptions.Instance.AppDataDirectory, "*.act", edversion, "Action File");
#endif
            }

            mgr.Sort();

            panelVScroll.SuspendLayout();

            int[] tabs;
            if (managedownloadmode)
            {
                tabs = new int[] { 0, 100, 300, 380, 590, 770, 860, 940 }
            }
            ;
            else
            {
                tabs = new int[] { 0, 100, 300, 380, 590, 590, 740, 840 }
            };

            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[0] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Type"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[1] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Name"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[2] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Version"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[3] + panelleftmargin, panelheightmargin), Size = new Size(120, 24), Text = "Description"
            });
            if (managedownloadmode)
            {
                panelVScroll.Controls.Add(new Label()
                {
                    Location = new Point(tabs[4] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Status"
                });
            }
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[5] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Action"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[6] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Delete"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[7] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Enabled"
            });

            int vpos = panelheightmargin + 30;

            foreach (VersioningManager.DownloadItem di in mgr.downloaditems)
            {
                Group g = new Group();
                g.di                = di;
                g.panel             = new Panel();
                g.panel.BorderStyle = BorderStyle.FixedSingle;
                g.panel.Tag         = g;
                g.panel.MouseEnter += MouseEnterControl;

                g.type          = new Label();
                g.type.Location = new Point(tabs[0], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.type.Size     = new Size(tabs[1] - tabs[0], 24);
                g.type.Text     = di.itemtype;
                g.panel.Controls.Add(g.type);

                g.info          = new ExtendedControls.ButtonExt();
                g.info.Location = new Point(tabs[1], labelheightmargin + 2);      // 8 spacing, allow 8*4 to indent
                g.info.Size     = new Size(16, 16);
                g.info.Text     = "i";
                g.info.Click   += Info_Click;
                g.info.Tag      = g;
                g.panel.Controls.Add(g.info);

                g.name          = new Label();
                g.name.Location = new Point(tabs[1] + 18, labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.name.Size     = new Size(tabs[2] - tabs[1] - 18, 24);
                g.name.Text     = di.itemname;
                g.panel.Controls.Add(g.name);

                g.version          = new Label();
                g.version.Location = new Point(tabs[2], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.version.Size     = new Size(tabs[3] - tabs[2], 24);
                g.version.Text     = (di.localversion != null) ? di.localversion.ToString(".") : "N/A";
                g.panel.Controls.Add(g.version);

                g.shortdesc          = new Label();
                g.shortdesc.Location = new Point(tabs[3], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.shortdesc.Size     = new Size(tabs[4] - tabs[3], 24);
                g.shortdesc.Text     = di.ShortLocalDescription;
                if (g.shortdesc.Text.Length == 0)
                {
                    g.shortdesc.Text = "N/A";
                }
                g.panel.Controls.Add(g.shortdesc);

                if (managedownloadmode)
                {
                    string text;
                    if (di.state == VersioningManager.ItemState.EDOutOfDate)
                    {
                        text = "Newer EDD required";
                    }
                    else if (di.state == VersioningManager.ItemState.UpToDate)
                    {
                        text = (di.localmodified) ? "Locally modified" : "Up to Date";
                    }
                    else if (di.state == VersioningManager.ItemState.LocalOnly)
                    {
                        text = "Local Only";
                    }
                    else if (di.state == VersioningManager.ItemState.NotPresent)
                    {
                        text = "Version " + di.downloadedversion.ToString(".") + ((di.localmodified) ? "*" : "");
                    }
                    else
                    {
                        text = "New version " + di.downloadedversion.ToString(".") + ((di.localmodified) ? "*" : "");
                    }

                    g.actionlabel          = new Label();
                    g.actionlabel.Location = new Point(tabs[4], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                    g.actionlabel.Size     = new Size(tabs[5] - tabs[4], 24);
                    g.actionlabel.Text     = text;
                    g.panel.Controls.Add(g.actionlabel);

                    if (text.Contains("ersion"))        // cheap and nasty way
                    {
                        g.actionbutton          = new ExtendedControls.ButtonExt();
                        g.actionbutton.Location = new Point(tabs[5], labelheightmargin - 4);      // 8 spacing, allow 8*4 to indent
                        g.actionbutton.Size     = new Size(80, 24);
                        g.actionbutton.Text     = (di.state == VersioningManager.ItemState.NotPresent) ? "Install" : "Update";
                        g.actionbutton.Click   += Actionbutton_Click;
                        g.actionbutton.Tag      = g;
                        g.panel.Controls.Add(g.actionbutton);
                    }
                }
                else
                {
                    bool loaded = CheckActionLoaded != null?CheckActionLoaded(g.di.itemname) : false;

                    if (loaded)     // may not be loaded IF its got an error.
                    {
                        g.actionbutton          = new ExtendedControls.ButtonExt();
                        g.actionbutton.Location = new Point(tabs[5], labelheightmargin - 4);      // 8 spacing, allow 8*4 to indent
                        g.actionbutton.Size     = new Size(80, 24);
                        g.actionbutton.Text     = "Edit";
                        g.actionbutton.Click   += ActionbuttonEdit_Click;
                        g.actionbutton.Tag      = g;
                        g.panel.Controls.Add(g.actionbutton);
                    }
                }

                if (di.HasLocalCopy)
                {
                    g.deletebutton          = new ExtendedControls.ButtonExt();
                    g.deletebutton.Location = new Point(tabs[6], labelheightmargin - 4);      // 8 spacing, allow 8*4 to indent
                    g.deletebutton.Size     = new Size(24, 24);
                    g.deletebutton.Text     = "X";
                    g.deletebutton.Click   += Deletebutton_Click;
                    g.deletebutton.Tag      = g;
                    g.panel.Controls.Add(g.deletebutton);
                }

                if (di.localenable.HasValue)
                {
                    g.enabled          = new ExtendedControls.CheckBoxCustom();
                    g.enabled.Location = new Point(tabs[7], labelheightmargin);
                    g.enabled.Size     = new Size(100, 20);
                    g.enabled.Text     = "Enabled";
                    g.enabled.Checked  = di.localenable.Value;
                    g.enabled.Click   += Enabled_Click;
                    g.enabled.Tag      = g;
                    g.panel.Controls.Add(g.enabled);
                }

                int panelwidth = Math.Max(panelVScroll.Width - panelVScroll.ScrollBarWidth, 10) - panelleftmargin * 2;

                g.panel.Location = new Point(panelleftmargin, vpos);
                g.panel.Size     = new Size(panelwidth, 32);

                vpos += g.panel.Height + 4;

                panelVScroll.Controls.Add(g.panel);
            }

            buttonMore.Location = new Point(panelleftmargin, vpos);

            EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance;
            if (theme != null)
            {
                theme.ApplyToControls(panelVScroll, font);
            }

            panelVScroll.ResumeLayout();
        }

        bool infoclicked = false;
Esempio n. 19
0
        void ReadyToDisplay()
        {
            this.Cursor = Cursors.Default;

            mgr = new VersioningManager();

            int[] edversion = System.Reflection.Assembly.GetExecutingAssembly().GetVersionInts();
            System.Diagnostics.Debug.Assert(edversion != null);

            ReadLocalFiles(mgr, managedownloadmode);

            if (managedownloadmode)
            {
                mgr.ReadInstallFiles(EDDiscovery.Properties.Resources.URLGithubDataDownload, "ActionFiles/V1", downloadactfolder, EDDOptions.Instance.AppDataDirectory, "*.act", edversion, "Action File");
                mgr.ReadInstallFiles(EDDiscovery.Properties.Resources.URLGithubDataDownload, "AddonFiles/V1", downloadaddonfolder, EDDOptions.Instance.AppDataDirectory, "*.inf", edversion, "Other File");
#if DEBUG
                mgr.ReadInstallFiles(EDDiscovery.Properties.Resources.URLGithubDataDownload, "ActionFiles/Debug", downloadactdebugfolder, EDDOptions.Instance.AppDataDirectory, "*.act", edversion, "Action File");
#endif
            }

            mgr.Sort();

            panelVScroll.RemoveAllControls();       // blank
            panelVScroll.SuspendLayout();

            int[] tabs;
            if (managedownloadmode)
            {
                //               type, n,  ver  des  stat act, del, ena
                tabs = new int[] { 0, 80, 280, 360, 560, 660, 760, 820, 880 }
            }
            ;
            else
            {
                tabs = new int[] { 0, 80, 280, 360, 560, 560, 660, 720, 780 }
            };

            var theme = ExtendedControls.Theme.Current;

            int fonth       = (int)theme.GetFont.GetHeight() + 1;
            int headervsize = fonth + panelheightmargin + 2;

            int vpos = headervsize + 8;

            // draw everything in 8.25 point position then scale

            int maxpanelwidth = 0;

            foreach (VersioningManager.DownloadItem di in mgr.DownloadItems)
            {
                Group g = new Group();
                g.di                = di;
                g.panel             = new Panel();
                g.panel.BorderStyle = BorderStyle.FixedSingle;
                g.panel.Tag         = g;
                g.panel.MouseEnter += MouseEnterControl;

                g.type          = new Label();
                g.type.Location = new Point(tabs[0], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.type.Size     = new Size(tabs[1] - tabs[0], 24);
                g.type.Text     = di.itemtype;
                g.panel.Controls.Add(g.type);

                g.info          = new ExtendedControls.ExtButton();
                g.info.Location = new Point(tabs[1], labelheightmargin - 4);      // 8 spacing, allow 8*4 to indent
                g.info.Size     = new Size(16, 16);
                g.info.Text     = "i";
                g.info.Click   += Info_Click;
                g.info.Tag      = g;
                g.panel.Controls.Add(g.info);

                g.name          = new Label();
                g.name.Location = new Point(tabs[1] + 32, labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.name.Size     = new Size(tabs[2] - tabs[1] - 32, 24);
                g.name.Text     = di.itemname;
                g.panel.Controls.Add(g.name);

                g.version          = new Label();
                g.version.Location = new Point(tabs[2], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.version.Size     = new Size(tabs[3] - tabs[2], 24);
                g.version.Text     = (di.localversion != null) ? di.localversion.ToString(".") : "N/A";
                g.panel.Controls.Add(g.version);

                g.shortdesc          = new Label();
                g.shortdesc.Location = new Point(tabs[3], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.shortdesc.Size     = new Size(tabs[4] - tabs[3], 24);
                g.shortdesc.Text     = di.ShortLocalDescription;
                if (g.shortdesc.Text.Length == 0)
                {
                    g.shortdesc.Text = "N/A";
                }
                g.panel.Controls.Add(g.shortdesc);

                if (managedownloadmode)
                {
                    bool   isversion = false;
                    string text;
                    if (di.state == VersioningManager.ItemState.EDOutOfDate)
                    {
                        text = "Newer EDD required".T(EDTx.AddOnManagerForm_Newer);
                    }
                    else if (di.state == VersioningManager.ItemState.EDTooOld)
                    {
                        text = "Too old for EDD".T(EDTx.AddOnManagerForm_Old);
                    }
                    else if (di.state == VersioningManager.ItemState.UpToDate)
                    {
                        text = (di.localmodified) ? "Locally modified".T(EDTx.AddOnManagerForm_Locallymodified) : "Up to Date".T(EDTx.AddOnManagerForm_UptoDate);
                    }
                    else if (di.state == VersioningManager.ItemState.LocalOnly)
                    {
                        text = "Local Only".T(EDTx.AddOnManagerForm_LocalOnly);
                    }
                    else if (di.state == VersioningManager.ItemState.NotPresent)
                    {
                        isversion = true;
                        text      = "Version".T(EDTx.AddOnManagerForm_Version) + " " + di.downloadedversion.ToString(".") + ((di.localmodified) ? "*" : "");
                    }
                    else
                    {
                        isversion = true;
                        text      = "New version".T(EDTx.AddOnManagerForm_Newversion) + " " + di.downloadedversion.ToString(".") + ((di.localmodified) ? "*" : "");
                    }

                    g.actionlabel          = new Label();
                    g.actionlabel.Location = new Point(tabs[4], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                    g.actionlabel.Size     = new Size(tabs[5] - tabs[4], 24);
                    g.actionlabel.Text     = text;
                    g.panel.Controls.Add(g.actionlabel);

                    if (isversion)
                    {
                        g.actionbutton          = new ExtendedControls.ExtButton();
                        g.actionbutton.Location = new Point(tabs[5], labelheightmargin - 4);      // 8 spacing, allow 8*4 to indent
                        g.actionbutton.Size     = new Size(tabs[6] - tabs[5] - 20, 24);
                        g.actionbutton.Text     = (di.state == VersioningManager.ItemState.NotPresent) ? "Install".T(EDTx.AddOnManagerForm_Install) : "Update".T(EDTx.AddOnManagerForm_Update);
                        g.actionbutton.Click   += Actionbutton_Click;
                        g.actionbutton.Tag      = g;
                        g.panel.Controls.Add(g.actionbutton);
                    }
                }
                else
                {
                    bool loaded = CheckActionLoaded != null?CheckActionLoaded(g.di.itemname) : false;

                    if (loaded)     // may not be loaded IF its got an error.
                    {
                        if (!di.localnoteditable)
                        {
                            g.actionbutton          = new ExtendedControls.ExtButton();
                            g.actionbutton.Location = new Point(tabs[5], labelheightmargin - 4);      // 8 spacing, allow 8*4 to indent
                            g.actionbutton.Size     = new Size(tabs[6] - tabs[5] - 20, 24);
                            g.actionbutton.Text     = "Edit".T(EDTx.AddOnManagerForm_Edit);
                            g.actionbutton.Click   += ActionbuttonEdit_Click;
                            g.actionbutton.Tag      = g;
                            g.panel.Controls.Add(g.actionbutton);
                        }
                    }
                }

                if (di.HasLocalCopy)
                {
                    g.deletebutton          = new ExtendedControls.ExtButton();
                    g.deletebutton.Location = new Point(tabs[6], labelheightmargin - 4);      // 8 spacing, allow 8*4 to indent
                    g.deletebutton.Size     = new Size(24, 24);
                    g.deletebutton.Text     = "X";
                    g.deletebutton.Click   += Deletebutton_Click;
                    g.deletebutton.Tag      = g;
                    g.panel.Controls.Add(g.deletebutton);
                }

                if (di.localenable.HasValue)
                {
                    g.enabled          = new ExtendedControls.ExtCheckBox();
                    g.enabled.Location = new Point(tabs[7], labelheightmargin - 4);
                    g.enabled.Size     = new Size(tabs[8] - tabs[7], 24);
                    g.enabled.Text     = "";
                    g.enabled.Checked  = di.localenable.Value;
                    g.enabled.Click   += Enabled_Click;
                    g.enabled.Tag      = g;
                    g.enabled.Enabled  = !di.localnotdisableable;
                    g.panel.Controls.Add(g.enabled);
                }

                g.panel.Location = new Point(panelleftmargin, vpos);
                g.panel.Size     = g.panel.FindMaxSubControlArea(4, 4);

                maxpanelwidth = Math.Max(maxpanelwidth, g.panel.Width);

                panelVScroll.Controls.Add(g.panel);
                vpos += g.panel.Height + 4;
            }

            foreach (Control c in panelVScroll.Controls)        // set all the sub items, which are panels, to max panel width
            {
                c.Width = maxpanelwidth;
            }

            // then add the titles

            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[0] + panelleftmargin, panelheightmargin), Size = new Size(tabs[1] - tabs[0] - 2, headervsize), Text = "Type".T(EDTx.AddOnManagerForm_Type)
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[1] + panelleftmargin, panelheightmargin), Size = new Size(tabs[2] - tabs[1] - 2, headervsize), Text = "Name".T(EDTx.AddOnManagerForm_Name)
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[2] + panelleftmargin, panelheightmargin), Size = new Size(tabs[3] - tabs[2] - 2, headervsize), Text = "Version".T(EDTx.AddOnManagerForm_Version)
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[3] + panelleftmargin, panelheightmargin), Size = new Size(tabs[4] - tabs[3] - 2, headervsize), Text = "Description".T(EDTx.AddOnManagerForm_Description)
            });
            if (managedownloadmode)
            {
                panelVScroll.Controls.Add(new Label()
                {
                    Location = new Point(tabs[4] + panelleftmargin, panelheightmargin), Size = new Size(tabs[5] - tabs[4] - 2, headervsize), Text = "Status".T(EDTx.AddOnManagerForm_Status)
                });
            }
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[5] + panelleftmargin, panelheightmargin), Size = new Size(tabs[6] - tabs[5] - 2, headervsize), Text = "Action".T(EDTx.AddOnManagerForm_Action)
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[6] + panelleftmargin, panelheightmargin), Size = new Size(tabs[7] - tabs[6] - 2, headervsize), Text = "Delete".T(EDTx.AddOnManagerForm_Delete)
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[7] + panelleftmargin, panelheightmargin), Size = new Size(tabs[8] - tabs[7] - 2, headervsize), Text = "Enabled".T(EDTx.AddOnManagerForm_Enabled)
            });

            if (!managedownloadmode)        // add on a more button if in edit pack mode
            {
                ExtendedControls.ExtButton dynmore = new ExtendedControls.ExtButton();
                dynmore.Size   = new System.Drawing.Size(24, 24);
                dynmore.Text   = "+";
                dynmore.Click += new System.EventHandler(this.buttonMore_Click);
                dynmore.UseVisualStyleBackColor = true;
                dynmore.Location = new Point(panelleftmargin, vpos);
                panelVScroll.Controls.Add(dynmore);
            }

            panelVScroll.Scale(this.CurrentAutoScaleFactor());       // scale newly added children to form

            theme.ApplyStd(panelVScroll);

            panelVScroll.ResumeLayout();
        }

        bool infoclicked = false;
Esempio n. 20
0
        void ReadyToDisplay()
        {
            panelVScroll.RemoveAllControls();

            mgr = new VersioningManager();

            int[] edversion = ObjectExtensionsNumbersBool.GetEDVersion();
            System.Diagnostics.Debug.Assert(edversion != null);

            mgr.ReadLocalFiles(Tools.GetAppDataDirectory(), "Actions", "*.act", "Action File");
            mgr.ReadInstallFiles(downloadactfolder, Tools.GetAppDataDirectory(), "*.act", edversion, "Action File");

#if DEBUG
            mgr.ReadInstallFiles(downloadactdebugfolder, Tools.GetAppDataDirectory(), "*.act", edversion, "Action File");
#endif

            mgr.ReadLocalFiles(Tools.GetAppDataDirectory(), "Flights", "*.vid", "Video File");
            mgr.ReadInstallFiles(downloadflightfolder, Tools.GetAppDataDirectory(), "*.vid", edversion, "Video File");

            mgr.Sort();

            panelVScroll.SuspendLayout();

            int[] tabs = { 0, 100, 260, 340, 550, 730, 820, 900 };

            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[0] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Type"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[1] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Name"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[2] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Version"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[3] + panelleftmargin, panelheightmargin), Size = new Size(120, 24), Text = "Description"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[4] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Status"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[5] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Action"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[6] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Delete"
            });
            panelVScroll.Controls.Add(new Label()
            {
                Location = new Point(tabs[7] + panelleftmargin, panelheightmargin), Size = new Size(80, 24), Text = "Enabled"
            });

            int vpos = panelheightmargin + 30;

            foreach (VersioningManager.DownloadItem di in mgr.downloaditems)
            {
                Group g = new Group();
                g.di                = di;
                g.panel             = new Panel();
                g.panel.BorderStyle = BorderStyle.FixedSingle;
                g.panel.Tag         = g;
                g.panel.MouseEnter += MouseEnterControl;

                g.type          = new Label();
                g.type.Location = new Point(tabs[0], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.type.Size     = new Size(tabs[1] - tabs[0], 24);
                g.type.Text     = di.itemtype;
                g.panel.Controls.Add(g.type);

                g.info          = new ExtendedControls.ButtonExt();
                g.info.Location = new Point(tabs[1], labelheightmargin + 2);      // 8 spacing, allow 8*4 to indent
                g.info.Size     = new Size(16, 16);
                g.info.Text     = "i";
                g.info.Click   += Info_Click;
                g.info.Tag      = g;
                g.panel.Controls.Add(g.info);

                g.name          = new Label();
                g.name.Location = new Point(tabs[1] + 18, labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.name.Size     = new Size(tabs[2] - tabs[1] - 18, 24);
                g.name.Text     = di.itemname;
                g.panel.Controls.Add(g.name);

                g.version          = new Label();
                g.version.Location = new Point(tabs[2], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.version.Size     = new Size(tabs[3] - tabs[2], 24);
                g.version.Text     = (di.localversion != null) ? di.localversion.ToString(".") : "N/A";
                g.panel.Controls.Add(g.version);

                g.shortdesc          = new Label();
                g.shortdesc.Location = new Point(tabs[3], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.shortdesc.Size     = new Size(tabs[4] - tabs[3], 24);
                g.shortdesc.Text     = di.ShortLocalDescription;
                if (g.shortdesc.Text.Length == 0)
                {
                    g.shortdesc.Text = "N/A";
                }
                g.panel.Controls.Add(g.shortdesc);

                string text;
                if (di.state == VersioningManager.ItemState.EDOutOfDate)
                {
                    text = "Newer EDD required";
                }
                else if (di.state == VersioningManager.ItemState.UpToDate)
                {
                    text = (di.localmodified) ? "Locally modified" : "Up to Date";
                }
                else if (di.state == VersioningManager.ItemState.LocalOnly)
                {
                    text = "Local Only";
                }
                else if (di.state == VersioningManager.ItemState.NotPresent)
                {
                    text = "Version " + di.downloadedversion.ToString(".") + ((di.localmodified) ? "*" : "");
                }
                else
                {
                    text = "New version " + di.downloadedversion.ToString(".") + ((di.localmodified) ? "*" : "");
                }

                g.actionlabel          = new Label();
                g.actionlabel.Location = new Point(tabs[4], labelheightmargin);      // 8 spacing, allow 8*4 to indent
                g.actionlabel.Size     = new Size(tabs[5] - tabs[4], 24);
                g.actionlabel.Text     = text;
                g.panel.Controls.Add(g.actionlabel);

                if (text.Contains("ersion"))        // cheap and nasty way
                {
                    g.actionbutton          = new ExtendedControls.ButtonExt();
                    g.actionbutton.Location = new Point(tabs[5], labelheightmargin - 4);      // 8 spacing, allow 8*4 to indent
                    g.actionbutton.Size     = new Size(80, 24);
                    g.actionbutton.Text     = (di.state == VersioningManager.ItemState.NotPresent) ? "Install" : "Update";
                    g.actionbutton.Click   += Actionbutton_Click;
                    g.actionbutton.Tag      = g;
                    g.panel.Controls.Add(g.actionbutton);
                }

                if (di.HasLocalCopy)
                {
                    g.deletebutton          = new ExtendedControls.ButtonExt();
                    g.deletebutton.Location = new Point(tabs[6], labelheightmargin - 4);      // 8 spacing, allow 8*4 to indent
                    g.deletebutton.Size     = new Size(24, 24);
                    g.deletebutton.Text     = "X";
                    g.deletebutton.Click   += Deletebutton_Click;
                    g.deletebutton.Tag      = g;
                    g.panel.Controls.Add(g.deletebutton);
                }

                if (di.localenable.HasValue)
                {
                    g.enabled          = new ExtendedControls.CheckBoxCustom();
                    g.enabled.Location = new Point(tabs[7], labelheightmargin);
                    g.enabled.Size     = new Size(100, 20);
                    g.enabled.Text     = "Enabled";
                    g.enabled.Checked  = di.localenable.Value;
                    g.enabled.Click   += Enabled_Click;
                    g.enabled.Tag      = g;
                    g.panel.Controls.Add(g.enabled);
                }

                int panelwidth = Math.Max(panelVScroll.Width - panelVScroll.ScrollBarWidth, 10) - panelleftmargin * 2;

                g.panel.Location = new Point(panelleftmargin, vpos);
                g.panel.Size     = new Size(panelwidth, 32);

                vpos += g.panel.Height + 4;

                panelVScroll.Controls.Add(g.panel);
            }

            EDDiscovery.EDDTheme theme = EDDiscovery.EDDTheme.Instance;
            if (theme != null)
            {
                theme.ApplyToControls(panelVScroll, font);
            }

            panelVScroll.ResumeLayout();
        }
Esempio n. 21
0
        public void CommitVersionedText(ScrText scrText, string comment)
        {
            VersionedText vText = VersioningManager.Get(scrText);

            vText.Commit(comment, null, false);
        }