Пример #1
0
 public override void FromData(IZDataBase data)
 {
     if (data != null)
     {
         AuditTrailLogDTO       dto  = new AuditTrailLogDTO(data);
         AuditTrailLogViewModel view = (new List <AuditTrailLogDTO> {
             (AuditTrailLogDTO)dto
         })
                                       .Select(GetViewSelector())
                                       .SingleOrDefault();
         LibraryHelper.Clone(view, this);
     }
 }
 public override void FromData(IZDataBase data)
 {
     if (data != null)
     {
         EmployeeTerritoryDTO       dto  = new EmployeeTerritoryDTO(data);
         EmployeeTerritoryViewModel view = (new List <EmployeeTerritoryDTO> {
             (EmployeeTerritoryDTO)dto
         })
                                           .Select(GetViewSelector())
                                           .SingleOrDefault();
         LibraryHelper.Clone(view, this);
     }
 }
 public override void FromData(IZDataBase data)
 {
     if (data != null)
     {
         CustomerDemographicDTO       dto  = new CustomerDemographicDTO(data);
         CustomerDemographicViewModel view = (new List <CustomerDemographicDTO> {
             (CustomerDemographicDTO)dto
         })
                                             .Select(GetViewSelector())
                                             .SingleOrDefault();
         LibraryHelper.Clone(view, this);
     }
 }
Пример #4
0
        private void RemoveBook(object sender, EventArgs e)
        {
            if (lstBooks.SelectedIndex != -1)
            {
                object selectedItem = lstBooks.SelectedItem;

                string isbn = GetSelectedItemId(selectedItem);

                LibraryHelper.RemoveBook(isbn);

                LoadBoxes();
            }
        }
Пример #5
0
        public virtual bool IsRequired(string property)
        {
            bool result = false;

            PropertyInfo propertyInfo = LibraryHelper.GetProperty(this.GetType(), property);

            if (Attribute.IsDefined(propertyInfo, typeof(RequiredAttribute)))
            {
                result = true;
            }

            return(result);
        }
Пример #6
0
 public override void FromData(IZDataBase data)
 {
     if (data != null)
     {
         RoleDTO       dto  = new RoleDTO(data);
         RoleViewModel view = (new List <RoleDTO> {
             (RoleDTO)dto
         })
                              .Select(GetViewSelector())
                              .SingleOrDefault();
         LibraryHelper.Clone(view, this);
     }
 }
Пример #7
0
        public EdmManagerFTP()
        {
            RootDirectory = LibraryHelper.AppSettings <string>("EDM.FTPRoot");

            ftpClient = new FtpClient();

            ftpClient.Host        = LibraryHelper.AppSettings <string>("EDM.FTPServer");
            ftpClient.Port        = LibraryHelper.AppSettings <int>("EDM.FTPPort");
            ftpClient.Credentials = new NetworkCredential(LibraryHelper.AppSettings <string>("EDM.FTPUser"),
                                                          LibraryHelper.AppSettings <string>("EDM.FTPPassword"));

            ftpClient.Connect();
        }
Пример #8
0
        public ActionResult ImportGenre(TaskImportGenreModel viewModel)
        {
            viewModel.OperationResult.Clear();

            string path = "";

            try
            {
                if (!IsAuthorized("ImportGenre", viewModel.OperationResult))
                {
                    return(View("OperationResult", new OperationResultModel(viewModel.OperationResult)));
                }
                else if (ValidateModelState())
                {
                    if (viewModel.Upload != null && viewModel.Upload.ContentLength > 0)
                    {
                        // Save file

                        string file = Path.GetFileName(viewModel.Upload.FileName);
                        path = Path.Combine(Server.MapPath(LibraryHelper.AppSettings <string>("DirectoryImport")), file);
                        viewModel.Upload.SaveAs(path);

                        // Read file and Create Genre

                        // Application
                        IChinookGenericApplication <Genre> genreApplication =
                            DependencyResolver.Current.GetService <IChinookGenericApplication <Genre> >();
                        Application.ImportGenreTXTApplication(viewModel.OperationResult, path, genreApplication);

                        // Persistence
                        IChinookUnitOfWork unitOfWork =
                            DependencyResolver.Current.GetService <IChinookUnitOfWork>();
                        Application.ImportGenreTXTPersistence(viewModel.OperationResult, path, unitOfWork);
                    }
                }
            }
            catch (Exception exception)
            {
                viewModel.OperationResult.ParseException(exception);
            }
            finally
            {
                if (!String.IsNullOrEmpty(path))
                {
                    System.IO.File.Delete(path);
                }
            }

            return(View(viewModel));
        }
Пример #9
0
        public string GetFilePath(string entityName, int key, ZFileTypes fileType, bool create)
        {
            string filePath         = "";
            string extension        = LibraryHelper.GetFileExtension(fileType);
            string workingDirectory = "";

            try
            {
                workingDirectory = ftpClient.GetWorkingDirectory();

                entityName = (entityName == null) ? "" : entityName;
                string entityKey     = String.Format("{0:000000000}", (key / 100) * 100);
                string directoryPath = LibraryHelper.AddDirectorySeparator(RootDirectory) +
                                       ((entityName == "") ? entityName : entityName + "/") +
                                       entityKey;

                FTPCreateDirectoryPath(directoryPath);

                /*
                 * ftpClient.SetWorkingDirectory("/");
                 * if (!FTPDirectoryExists(path) && create) // /root/entityName/entityTree
                 * {
                 *  if (FTPCreateDirectory(RootDirectory))
                 *  {
                 *      ftpClient.SetWorkingDirectory(RootDirectory);
                 *      if (FTPCreateDirectory(entityName))
                 *      {
                 *          ftpClient.SetWorkingDirectory(entityName);
                 *          FTPCreateDirectory(entityTree);
                 *      }
                 *  }
                 * }
                 */

                ftpClient.SetWorkingDirectory("/");
                if (FTPDirectoryExists(directoryPath))
                {
                    filePath = directoryPath + "/" + String.Format("{0:000000000}", key) + extension;
                }
            }
            finally
            {
                if (!String.IsNullOrEmpty(workingDirectory))
                {
                    ftpClient.SetWorkingDirectory(workingDirectory);
                }
            }

            return(filePath);
        }
Пример #10
0
        private static byte[] SignData(FiscoTransModel trans, ECKeyPair key)
        {
            byte[][] b = new byte[10][];
            b[0] = trans.data.AccountNonce;
            b[1] = LibraryHelper.FromBigInteger(trans.data.Price);
            b[2] = LibraryHelper.FromBigInteger(trans.data.GasLimit);
            b[3] = LibraryHelper.FromBigInteger(trans.data.BlockLimit);
            b[4] = trans.data.Recipient;
            b[5] = trans.data.Amount == null ? null : LibraryHelper.FromBigInteger(trans.data.Amount);
            b[6] = trans.data.Payload;
            b[7] = LibraryHelper.FromBigInteger(trans.data.ChainID);
            b[8] = LibraryHelper.FromBigInteger(trans.data.GroupID);
            b[9] = trans.data.ExtraData;

            var txb = Nethereum.RLP.RLP.EncodeElementsAndList(b);

            if (trans.smcrypto)
            {
                BigInteger r, s;
                SM2Utils.Sign(SM2Utils.SM3Hash(txb), key.prik, out r, out s);
                trans.data.R = LibraryHelper.FromBigInteger(r);
                trans.data.S = LibraryHelper.FromBigInteger(s);

                var    pub1 = key.pubk.Q.XCoord.GetEncoded();
                var    pub2 = key.pubk.Q.YCoord.GetEncoded();
                byte[] v    = new byte[pub1.Length + pub2.Length];
                Array.Copy(pub1, 0, v, 0, pub1.Length);
                Array.Copy(pub2, 0, v, pub1.Length, pub2.Length);
                Console.WriteLine(string.Format("sign.V:{0}", Hex.ToHexString(v)));
                trans.data.V = v;
            }
            else
            {
                var bytes = EthUtils.ConvertSHA256byte(txb);
                var sign  = EthUtils.Sign(bytes, key.prik);
                trans.data.R = sign.Item1;
                trans.data.S = sign.Item2;
                trans.data.V = sign.Item3;
            }
            byte[][] si = new byte[b.Length + 3][];
            Array.Copy(b, 0, si, 0, b.Length);
            si[b.Length]     = trans.data.V;
            si[b.Length + 1] = trans.data.R;
            si[b.Length + 2] = trans.data.S;

            var txs = Nethereum.RLP.RLP.EncodeElementsAndList(si);

            return(txs);
        }
Пример #11
0
        private static void LibraryEdmFilePathDemo(IEdmManager edmManager)
        {
            Console.WriteLine("\nEDM Demo\n");

            string rootDirectory = ConfigurationHelper.AppSettings <string>("EDM.FileSystemDirectory");

            Console.WriteLine("IMPORTANT: Create \"" + rootDirectory + "\" directory !");
            Console.Write("\nPress <KEY> to continue... ");
            Console.ReadKey();
            Console.WriteLine("\n");

            string txtFilePath = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.txt";

            using (StreamWriter writer = new StreamWriter(txtFilePath))
            {
                writer.Write("EasyLOB");
            }

            byte[] file;
            string edmFilePath, exportPath;

            // 1
            Console.WriteLine("A/B/C");

            edmFilePath = "A/B/C/txt.txt";
            exportPath  = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.1.txt";

            Console.WriteLine("  Write TXT");
            edmManager.WriteFile(edmFilePath, txtFilePath);
            Console.WriteLine("  Read TXT");
            file = edmManager.ReadFile(edmFilePath);
            File.WriteAllBytes(exportPath, file);
            //Console.WriteLine("  Delete TXT");
            //edmManager.EdmEngine.DeleteFile(edmFilePath);

            // 101
            Console.WriteLine("101");

            edmFilePath = "A/D/E/txt.txt";
            exportPath  = LibraryHelper.AddDirectorySeparator(rootDirectory) + "txt.101.txt";

            Console.WriteLine("  Write TXT");
            edmManager.WriteFile(edmFilePath, txtFilePath);
            Console.WriteLine("  Read TXT");
            file = edmManager.ReadFile(edmFilePath);
            File.WriteAllBytes(exportPath, file);
            //Console.WriteLine("  Delete TXT");
            //edmManager.EdmEngine.DeleteFile(edmFilePath);
        }
Пример #12
0
        public override void FromData(IZDataBase data)
        {
            if (data != null)
            {
                Activity    activity = (Activity)data;
                ActivityDTO dto      = (new List <Activity> {
                    activity
                })
                                       .Select(GetDTOSelector())
                                       .SingleOrDefault();
                dto.LookupText = activity.LookupText;

                LibraryHelper.Clone(dto, this);
            }
        }
Пример #13
0
        public async Task <LibraryLocationItem> UpdateLibrary(string libraryPath, string defaultSaveFolder = null, string[] folders = null, bool?isPinned = null)
        {
            var newLib = await LibraryHelper.UpdateLibrary(libraryPath, defaultSaveFolder, folders, isPinned);

            if (newLib != null)
            {
                var libItem = Libraries.FirstOrDefault(l => string.Equals(l.Path, libraryPath, StringComparison.OrdinalIgnoreCase));
                if (libItem != null)
                {
                    Libraries[Libraries.IndexOf(libItem)] = newLib;
                }
                return(newLib);
            }
            return(null);
        }
Пример #14
0
        public override void FromData(IZDataBase data)
        {
            if (data != null)
            {
                Role    role = (Role)data;
                RoleDTO dto  = (new List <Role> {
                    role
                })
                               .Select(GetDTOSelector())
                               .SingleOrDefault();
                dto.LookupText = role.LookupText;

                LibraryHelper.Clone(dto, this);
            }
        }
Пример #15
0
        /// <summary>
        /// Get profile by type.
        /// </summary>
        /// <param name="type">Type</param>
        /// <returns></returns>
        public static IZProfile GetProfile(Type type)
        {
            IZProfile profile;

            if (Profiles.Keys.Contains(type))
            {
                profile = Profiles[type];
            }
            else
            {
                profile = (IZProfile)LibraryHelper.GetStaticPropertyValue(type, "Profile");
            }

            return(profile);
        }
Пример #16
0
        public override void FromData(IZDataBase data)
        {
            if (data != null)
            {
                AuditTrailConfiguration    auditTrailConfiguration = (AuditTrailConfiguration)data;
                AuditTrailConfigurationDTO dto = (new List <AuditTrailConfiguration> {
                    auditTrailConfiguration
                })
                                                 .Select(GetDTOSelector())
                                                 .SingleOrDefault();
                dto.LookupText = auditTrailConfiguration.LookupText;

                LibraryHelper.Clone(dto, this);
            }
        }
Пример #17
0
        public About()
        {
            InitializeComponent();
            label1.Text = Texts.rm.GetString("APPLICATIONNAME", Texts.cultereinfo);
            label2.Text = Texts.rm.GetString("ABOUTINFOAPPVERSIONLABEL", Texts.cultereinfo) + Assembly.GetExecutingAssembly().GetName().Version.ToString();
            label3.Text = Texts.rm.GetString("ABOUTLABELUSEDBIBLE", Texts.cultereinfo);
            this.Text   = Texts.rm.GetString("ABOUTNAMETEXT", Texts.cultereinfo);
            LibraryHelper instance = new LibraryHelper();

            instance.prepareLibraryList();
            foreach (var item in instance.toAdd)
            {
                richTextBox1.AppendText(item.Name + " " + item.Github_repo + Environment.NewLine);
            }
        }
Пример #18
0
        public override void FromData(IZDataBase data)
        {
            if (data != null)
            {
                AuditTrailLog    auditTrailLog = (AuditTrailLog)data;
                AuditTrailLogDTO dto           = (new List <AuditTrailLog> {
                    auditTrailLog
                })
                                                 .Select(GetDTOSelector())
                                                 .SingleOrDefault();
                dto.LookupText = auditTrailLog.LookupText;

                LibraryHelper.Clone(dto, this);
            }
        }
Пример #19
0
        public async Task <bool> CreateNewLibrary(string name)
        {
            if (!CanCreateLibrary(name).result)
            {
                return(false);
            }
            var newLib = await LibraryHelper.CreateLibrary(name);

            if (newLib != null)
            {
                Libraries.AddSorted(newLib);
                return(true);
            }
            return(false);
        }
Пример #20
0
        public override void FromData(IZDataBase data)
        {
            if (data != null)
            {
                User    user = (User)data;
                UserDTO dto  = (new List <User> {
                    user
                })
                               .Select(GetDTOSelector())
                               .SingleOrDefault();
                dto.LookupText = user.LookupText;

                LibraryHelper.Clone(dto, this);
            }
        }
Пример #21
0
        private static void PersistenceChinookLINQJoinDemo()
        {
            Console.WriteLine("\nPersistence Chinook LINQ Join Demo");

            var container = new UnityContainer();

            UnityHelper.RegisterMappings(container);

            IUnitOfWork unitOfWork = (IUnitOfWork)container.Resolve <IChinookUnitOfWork>();

            Console.WriteLine("\n" + unitOfWork.GetType().FullName + " with " + unitOfWork.DBMS.ToString());

            IGenericRepository <Album> repository = unitOfWork.GetRepository <Album>();

            IQueryable <Album> albums = unitOfWork.GetQuery <Album>();
            IQueryable <Track> tracks = unitOfWork.GetQuery <Track>();

            var result1 = albums
                          .Join(tracks, a => a.AlbumId, t => t.AlbumId, (a, t) => new { a, t })
                          .Where(x => x.a.AlbumId <= 3)
                          .OrderByDescending(x => x.a.Title)
                          .Select(x => new { x.a, x.t });

            Console.WriteLine();
            foreach (object o in result1)
            {
                //Console.WriteLine(o.ToString()); // { a = ZData.Chinook.Album, t = Chinook.Data.Track }
                Album album = (Album)LibraryHelper.GetPropertyValue(o, "a");
                Track track = (Track)LibraryHelper.GetPropertyValue(o, "t");
                Console.WriteLine(album.AlbumId + " - " + album.Title + " : " + track.Name);
            }

            var result2 =
                from a in albums
                join t in tracks on a.AlbumId equals t.AlbumId
                where a.AlbumId <= 3
                orderby a.Title descending
                select new { a, t };

            Console.WriteLine();
            foreach (object o in result2)
            {
                //Console.WriteLine(o.ToString()); // { a = ZData.Chinook.Album, t = Chinook.Data.Track }
                Album album = (Album)LibraryHelper.GetPropertyValue(o, "a");
                Track track = (Track)LibraryHelper.GetPropertyValue(o, "t");
                Console.WriteLine(album.AlbumId + " - " + album.Title + " : " + track.Name);
            }
        }
Пример #22
0
        /// <summary>
        /// Setup Data Profile for assembly.
        /// </summary>
        /// <param name="dataAssemblyName">Data assembly</param>
        public static void SetupDataProfile(string dataAssemblyName)
        {
            Assembly.Load(dataAssemblyName);
            Assembly dataAssembly = LibraryHelper.GetAssembly(dataAssemblyName);

            Type[] types = dataAssembly.GetTypes();
            foreach (Type typeDataModel in types)
            {
                if (typeDataModel.IsSubclassOf(typeof(ZDataBase)) && !typeDataModel.IsAbstract)
                {
                    IZProfile profile = SetDataProfile(typeDataModel);

                    LibraryHelper.InvokeMethod(typeDataModel, "OnSetupProfile", new object[] { profile });
                }
            }
        }
Пример #23
0
        public override void FromData(IZDataBase data)
        {
            if (data != null)
            {
                UserClaim    userClaim = (UserClaim)data;
                UserClaimDTO dto       = (new List <UserClaim> {
                    userClaim
                })
                                         .Select(GetDTOSelector())
                                         .SingleOrDefault();
                dto.UserLookupText = userClaim.User == null ? null : userClaim.User.LookupText;
                dto.LookupText     = userClaim.LookupText;

                LibraryHelper.Clone(dto, this);
            }
        }
Пример #24
0
        private List <Book> GetSelectedItems(ListBox.
                                             SelectedObjectCollection selectedItems)
        {
            List <string> stringISBNs = new List <string>();

            foreach (var item in selectedItems)
            {
                stringISBNs.Add(item.ToString().
                                Substring(0, item.ToString().IndexOf(",")));
            }

            List <Book> selectedBooks =
                LibraryHelper.GetSelectedBooks(stringISBNs);

            return(selectedBooks);
        }
        public NorthwindUnitOfWorkRedis()
            : base(LibraryHelper.AppSettings <string>("Redis.Northwind"))
        {
            Domain = "Northwind";

            ModelConfig <Category> .Id(x => x.CategoryId);

            ModelConfig <CustomerCustomerDemo> .Id(x => x.CustomerId);

            ModelConfig <CustomerDemographic> .Id(x => x.CustomerTypeId);

            ModelConfig <Customer> .Id(x => x.CustomerId);

            ModelConfig <Employee> .Id(x => x.EmployeeId);

            ModelConfig <EmployeeTerritory> .Id(x => x.EmployeeId);

            ModelConfig <OrderDetail> .Id(x => x.OrderId);

            ModelConfig <Order> .Id(x => x.OrderId);

            ModelConfig <Product> .Id(x => x.ProductId);

            ModelConfig <Region> .Id(x => x.RegionId);

            ModelConfig <Shipper> .Id(x => x.ShipperId);

            ModelConfig <Supplier> .Id(x => x.SupplierId);

            ModelConfig <Territory> .Id(x => x.TerritoryId);

            Repositories.Add(typeof(Category), new NorthwindCategoryRepositoryRedis(this));
            Repositories.Add(typeof(CustomerCustomerDemo), new NorthwindCustomerCustomerDemoRepositoryRedis(this));
            Repositories.Add(typeof(CustomerDemographic), new NorthwindCustomerDemographicRepositoryRedis(this));
            Repositories.Add(typeof(Customer), new NorthwindCustomerRepositoryRedis(this));
            Repositories.Add(typeof(Employee), new NorthwindEmployeeRepositoryRedis(this));
            Repositories.Add(typeof(EmployeeTerritory), new NorthwindEmployeeTerritoryRepositoryRedis(this));
            Repositories.Add(typeof(OrderDetail), new NorthwindOrderDetailRepositoryRedis(this));
            Repositories.Add(typeof(Order), new NorthwindOrderRepositoryRedis(this));
            Repositories.Add(typeof(Product), new NorthwindProductRepositoryRedis(this));
            Repositories.Add(typeof(Region), new NorthwindRegionRepositoryRedis(this));
            Repositories.Add(typeof(Shipper), new NorthwindShipperRepositoryRedis(this));
            Repositories.Add(typeof(Supplier), new NorthwindSupplierRepositoryRedis(this));
            Repositories.Add(typeof(Territory), new NorthwindTerritoryRepositoryRedis(this));

            //IRedisClient client = base.Client;
        }
Пример #26
0
        /// <summary>
        /// Get Sequence generated by DBMS.
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="connectionName"></param>
        /// <returns></returns>
        public static object GetSequence(string entity, string connectionName)
        {
            object value = null;

            DbConnection connection = null;

            try
            {
                DbProviderFactory provider = AdoNetHelper.GetProvider(connectionName);
                connection = provider.CreateConnection();
                connection.ConnectionString = AdoNetHelper.GetConnectionString(connectionName);
                connection.Open();

                DbCommand command = connection.CreateCommand();
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = GetSequenceSql(GetDBMS(provider), entity);
                if (command.CommandText != "")
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                    }

                    try
                    {
                        value = LibraryHelper.ObjectToInt32(command.ExecuteScalar());
                    }
                    finally
                    {
                        connection.Close();
                    }
                }
            }
            catch (Exception exception)
            {
                throw new Exception("GetId", exception);
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }

            return(value);
        }
Пример #27
0
        public string GetResource(string resourceClass, string resourceKey)
        {
            string result = "";

            List <string> namespaces = new List <string>()
            {
                "EasyLOB.Activity.Resources",
                "EasyLOB.Activity.Data.Resources",
                "EasyLOB.AuditTrail.Resources",
                "EasyLOB.AuditTrail.Data.Resources",
                "EasyLOB.Extensions.Edm.Resources",
                "EasyLOB.Identity.Resources",
                "EasyLOB.Identity.Data.Resources",
                "EasyLOB.Library.Resources",
                "EasyLOB.Library.Syncfusion.Resources",
                "EasyLOB.Log.Resources",
                "EasyLOB.Resources",
                "EasyLOB.Security.Resources"
            };

            string[] resources = ConfigurationHelper.AppSettings <string>("EasyLOB.Resources").Split(',');
            foreach (string r in resources.Reverse())
            {
                namespaces.Insert(0, r);
            }

            Type type;

            foreach (string n in namespaces)
            {
                type = LibraryHelper.GetType(n + "." + resourceClass);
                if (type != null)
                {
                    try
                    {
                        result = (string)LibraryHelper.GetStaticPropertyValue(type, resourceKey);

                        break;
                    }
                    catch { }
                }
            }

            return(result);
        }
Пример #28
0
        /// <summary>
        /// Размещает на диаграмме укзаанный элемент и иерархию его контейнеров
        /// </summary>
        /// <param name="onlyParent"></param>
        /// <returns></returns>
        public ExecResult <Boolean> PutChildrenDHierarchyOnElement()
        {
            ExecResult <Boolean> result = new ExecResult <bool>();

            ElementDesignerHelper.CallLevel = 0;

            try
            {
                ExecResult <List <ComponentLevel> > displayLevelsResult = FSelectComponentLevels.Execute();
                if (displayLevelsResult.code != 0)
                {
                    return(result);
                }


                // Получаем текущий (библиотечный) элемент дерева
                if (Context.CurrentDiagram.SelectedObjects.Count == 0 || !LibraryHelper.IsLibrary(Context.EARepository.GetElementByID(((EA.DiagramObject)Context.CurrentDiagram.SelectedObjects.GetAt(0)).ElementID)))
                {
                    throw new Exception("Не выделен библиотечный элемент на диаграмме");
                }

                EA.Element curElement = Context.EARepository.GetElementByID(((EA.DiagramObject)Context.CurrentDiagram.SelectedObjects.GetAt(0)).ElementID);

                // Получаем список дочерних элементов контейнеров
                List <EA.Element> сhildrenDHierarchy = LibraryHelper.GetChildHierarchy(curElement);

                // Проходимся по иерархии и размещаем элементы на диаграмме
                for (int i = 0; i < сhildrenDHierarchy.Count; i++)
                {
                    // Размещаем элемент
                    EA.DiagramObject diagramObject = Context.Designer.PutElementOnDiagram(сhildrenDHierarchy[i]);
                    diagramObject.Update();
                }

                Context.CurrentDiagram.DiagramLinks.Refresh();
                Context.LinkDesigner.SetLinkTypeVisibility(LinkType.Deploy, false);
                Context.EARepository.ReloadDiagram(Context.CurrentDiagram.DiagramID);
            }
            catch (Exception ex)
            {
                result.setException(ex);
            }

            return(result);
        }
        public MainWindow(string[] args)
        {
            InitializeComponent();



            this.Title = $"{LibraryHelper.GetPackageInfo().Name ?? "Package Demo"} - v{LibraryHelper.GetPackageInfo().Version ?? "1.0.0"}";

            txtUIVersion.Text = $"{Assembly.GetExecutingAssembly().GetName().Version}";

            txtLibraryVersion.Text = $"{LibraryHelper.GetVersion()}";

            txtPackageVersion.Text = LibraryHelper.GetPackageInfo().Version ?? "N/A";

            if (args.Any())
            {
                txtArgs.Text = string.Join(Environment.NewLine, args);
            }
            else
            {
                txtArgs.Text = "N/A";
            }


            try
            {
                var test = Package.Current;
            }
            catch (InvalidOperationException e)
            {
            }


            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

            if (!localSettings.Values.ContainsKey("intro"))
            {
                var intro = new IntroWindow();
                intro.ShowDialog();
            }


            txtSetting1.Text = localSettings.Values.ContainsKey("setting1") ? localSettings.Values["setting1"].ToString() : "";
            txtSetting2.Text = localSettings.Values.ContainsKey("setting2") ? localSettings.Values["setting2"].ToString() : "";
        }
Пример #30
0
        public string GetFilePath(string edmFilePath, bool create)
        {
            string filePath = "";

            string directoryPath = Path.GetDirectoryName(LibraryHelper.AddDirectorySeparator(RootDirectory) + edmFilePath);

            if (!Directory.Exists(directoryPath) && create)
            {
                Directory.CreateDirectory(directoryPath);
            }

            if (Directory.Exists(directoryPath))
            {
                filePath = LibraryHelper.AddDirectorySeparator(RootDirectory) + edmFilePath;
            }

            return(filePath);
        }