예제 #1
0
        public override void ReadValue(GridControl gridControl, GridColumnDataEventArgs e)
        {
            int movieIndex  = gridControl.GetRowVisibleIndexByHandle(gridControl.GetRowHandleByListIndex(e.ListSourceRowIndex)) + 1;
            int moviesCount = gridControl.VisibleRowCount;

            e.Value = string.Format(ConstStrings.Get("MovieOf"), movieIndex, moviesCount);
        }
예제 #2
0
        public static LiteCollection <Server> GetServersList()
        {
            var pth = Path.Combine(ConstStrings.GetDataPath().FullName, $"{nameof(Kebler)}.db");


            using var db = new LiteDatabase(pth);
            var servers = db.GetCollection <Server>(nameof(GetServersList));

            return(servers);
        }
예제 #3
0
 public void CreateCustomer_Save_CheckTitle()
 {
     using (CustomerDetail detail = (CustomerDetail)ModulesManager.Current.OpenModuleObjectDetail(new CustomerDetailObject(Session, null), false)) {
         detail.CustomerEdit.VRObjectEditObject.VideoRentObject.FirstName = "x";
         detail.CustomerEdit.VRObjectEditObject.VideoRentObject.LastName  = "y";
         Assert.AreEqual(ConstStrings.Get("NewCustomer") + " *", detail.Title);
         Assert.IsTrue(detail.Save());
         Assert.AreEqual("x y", detail.Title);
     }
 }
예제 #4
0
        public override void UpdateUI()
        {
            //which display method?
            if (targetData.Value > maxSpawns)
            {
                //setup text element like: X5 lives
                textReadout.text = CommunityStringBuilder.Instance
                                   .Append(prefix)
                                   .Append(ConstStrings.GetCachedString(targetData))
                                   .Append(suffix)
                                   .ToString();

                //make change from AAAAAAAAA to A x5 lives
                if (objectPool.InUseCount != 1)                 //only need to do this once
                {
                    objectPool.ReturnAllToPool();
                    //show a single item
                    objectPool.Depool();
                    textReadout.enabled = true;
                }
            }
            else             //standard method
            {
                textReadout.enabled = false;
                //need to create more
                while (targetData.Value > objectPool.InUseCount)
                {
                    var item = objectPool.Depool();                    //(spawn)
                    if (item == null)
                    {
                        break;                                  //pool is exhausted
                    }
                }

                //have too many
                while (targetData.Value < objectPool.InUseCount)
                {
                    //local function to avoid lambda
                    bool IsGameObjectActive(GameObject obj)
                    => obj.activeSelf == true;

                    //look for an active item
                    var itemInUse = objectPool.Manifest.Find(IsGameObjectActive);
                    if (itemInUse == null)
                    {
                        break;                                       //break if not found
                    }
                    objectPool.Enpool(itemInUse);                    //return to pool (despawn)
                }
            }
        }
예제 #5
0
        static DemoModuleCategory GetPreparedCurrentCustomersRentCategory()
        {
            DemoModuleCategory category = new VideoRentModuleCategory(GroupRental, ConstStrings.Get("RentModule"), "Sale");

            BindingOperations.SetBinding(category, DemoModuleCategory.TitleProperty, new Binding("CurrentCustomer.FullName")
            {
                Source = CurrentCustomerProvider.Current, Converter = new StringFormatConverter(), ConverterParameter = ConstStrings.Get("RentModulePattern")
            });
            BindingOperations.SetBinding(category, ForwardingHelper.DataObjectProperty, new Binding("CurrentCustomer.Photo")
            {
                Source = CurrentCustomerProvider.Current
            });
            return(category);
        }
예제 #6
0
        public void TryDeleteDenyObject_CheckInfoMessage()
        {
            Assert.IsNotNull(Anton.DoRent(new RentInfo(Avatar, MovieItemFormat.DVD)));
            SessionHelper.CommitSession(Session, null);
            Assert.IsFalse(Avatar.AllowDelete);
            MoviesList moviesList = (MoviesList)ModulesManager.Current.OpenModuleObjectDetail(new MoviesListObject(Session), false);

            moviesList.MoviesEdit.CurrentRecord = SessionHelper.GetObject <Movie>(Avatar, moviesList.MoviesEdit.VRObjectsEditObject.VideoRentObjects.Session);
            TestMessageBoxView.ShowDelegate     = MessageBoxShow;
            Assert.IsFalse(moviesList.MoviesEdit.DeleteCurrentRecord());
            Assert.AreEqual(ConstStrings.Get("ObjectCanNotBeDeleted"), message);
            TestMessageBoxView.ShowDelegate = null;
            moviesList.Dispose();
        }
예제 #7
0
        //TutorialControlBase module;
        //DemoProducts products = DemoProducts.None;

        public ModuleInfo(string name, Type type, string description, string imageName, string group)
        {
            if (!type.IsSubclassOf(typeof(UserControl)))
            {
                throw new ArgumentException(ConstStrings.Get("SubclassError"));
            }
            this.name        = name;
            this.type        = type;
            this.imageName   = imageName;
            this.description = description;
            this.group       = group;
            //this.module = null;
            //this.products = products;
        }
예제 #8
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string name = value as string;

            if (name == null || name == ConstStrings.Get("None"))
            {
                return(null);
            }
            Marker2DModel model;

            if (!models.TryGetValue(name, out model))
            {
                return(null);
            }
            return(model);
        }
예제 #9
0
        /// <summary>
        /// Application grouprs
        /// </summary>
        static void CreateGroupAndCategories()
        {
            GroupRental         = new VideoRentModuleGroup(ConstStrings.Get("RentalGroup"), "Group_Rental");
            GroupCatalog        = new VideoRentModuleGroup(ConstStrings.Get("CatalogGroup"), "Group_Catalog");
            GroupAdministration = new VideoRentModuleGroup(ConstStrings.Get("AdminGroup"), "Group_Administrator");

            CategoryMovies          = new VideoRentModuleCategory(GroupCatalog, ConstStrings.Get("MoviesModule"), "Movie");
            CategoryArtists         = new VideoRentModuleCategory(GroupCatalog, ConstStrings.Get("ActorsModule"), "Actor");
            CategoryMovieCategories = new VideoRentModuleCategory(GroupCatalog, ConstStrings.Get("MovieCategories"), "Categories");
            CategoryCompanies       = new VideoRentModuleCategory(GroupCatalog, ConstStrings.Get("CompaniesModule"), "Company");

            CategoryCustomers = new VideoRentModuleCategory(GroupRental, ConstStrings.Get("CustomersModule"), "Person");
            CategoryAthlets   = new VideoRentModuleCategory(GroupRental, ConstStrings.Get("AthletsModule"), "Person");
            CategoryCurrentCustomerTransactions = new VideoRentModuleCategory(GroupRental, ConstStrings.Get("AccountTransactions"), "Revenue");

            CategoryCurrentCustomerRents = GetPreparedCurrentCustomersRentCategory();
        }
예제 #10
0
        /// <summary>
        /// ustala nowa wartośc setingsa podanego w stringu  Type, Lang lub Path
        /// </summary>
        /// <param name="Type"> typ setingsa</param>
        /// <param name="value"> wartość zmienianego parametru</param>
        public void UpdateSetings(string Type, string value)
        {
            var constS = new ConstStrings();
            var t      = $"S{Type}Target";
            var a      = $"S{Type}Area";
            var target = (string)constS.GetType().GetField(t).GetValue(this);
            var area   = (string)constS.GetType().GetField(a).GetValue(this);

            var tmpSet = new Settings
            {
                Area   = area,
                Target = target
            };
            var tmp = _all.Settings.Get(tmpSet);

            tmp.Value = value;
            _all.Settings.AddOrUpdate(tmp);
            _all.Settings.Save();
        }
예제 #11
0
        public static UnitOfWork SafeDeleteNoCommit(VideoRentBaseObject obj, string shureToDeleteMessage, Action <object> action)
        {
            if (!obj.AllowDelete)
            {
                MessageBox.Show(ConstStrings.Get("ObjectCanNotBeDeleted"), ConstStrings.Get("Warning"), MessageBoxButton.OK, MessageBoxImage.Warning);
                return(null);
            }
            if (!IsSureToDelete(shureToDeleteMessage))
            {
                return(null);
            }
            if (action != null)
            {
                action(null);
            }
            UnitOfWork uow = (UnitOfWork)obj.Session;

            obj.Delete();
            return(uow);
        }
예제 #12
0
 public static void FillNavBar(NavBarControl navBar, NavBarGroupStyle groupStyle, NavBarImage groupCaptionImage)
 {
     if (navBar == null)
     {
         return;
     }
     navBar.BeginUpdate();
     for (int i = 0; i < Count; i++)
     {
         if (GetItem(i).Group == ConstStrings.Get("AboutGroup"))
         {
             continue;
         }
         NavBarItem item = new NavBarItem();
         navBar.Items.Add(item);
         item.Caption = GetItem(i).Name;
         item.Tag     = GetItem(i);
         GetNavBarGroup(navBar, GetItem(i).Group, groupStyle, groupCaptionImage).ItemLinks.Add(new NavBarItemLink(item));
     }
     navBar.EndUpdate();
 }
예제 #13
0
        /// <summary>
        /// Popbiera wartość setingsa podanego w stringu Type, Lang lub Path
        /// </summary>
        /// <param name="Type">Typ setingsa</param>
        /// <returns></returns>
        public string GetSetings(string Type)
        {
            var constS = new ConstStrings();
            var t      = $"S{Type}Target";
            var a      = $"S{Type}Area";
            var target = (string)constS.GetType().GetField(t).GetValue(this);
            var area   = (string)constS.GetType().GetField(a).GetValue(this);

            try
            {
                var tmpSet = new Settings
                {
                    Area   = area,
                    Target = target
                };
                var tmp = _all.Settings.Get(tmpSet);
                return(tmp.Value);
            }
            catch (NotExistInDataBaseException)
            {
                AddSetings(area, target);
                return("?");
            }
        }
예제 #14
0
 public void ShowUnableToOpenMessage(bool createNew)
 {
     ThreadHelper.DoInThread(wnd.Dispatcher, () => MessageBox.Show(createNew ? ConstStrings.Get("UnableCreateDBMessage") : ConstStrings.Get("UnableOpenDBMessage"), ConstStrings.Get("Error"), MessageBoxButton.OK, MessageBoxImage.Error));
 }
예제 #15
0
 public void Process(Exception e)
 {
     MessageBox.Show(e.Message, ConstStrings.Get("Warning"), MessageBoxButton.OK, MessageBoxImage.Warning);
 }
예제 #16
0
        static void StartProcess(string processName)
        {
#if !SL //TODO
            try {
                Process.Start(processName);
            } catch (Exception ex) {
                DevExpress.VideoRent.ViewModel.ViewModelBase.MessageBox.Show(ex.Message, ConstStrings.Get("Error"), DevExpress.VideoRent.ViewModel.ViewModelBase.MessageBoxButton.OK, DevExpress.VideoRent.ViewModel.ViewModelBase.MessageBoxImage.Error);
            }
#endif
        }