Beispiel #1
0
        protected override void OnBindingContextChanged()
        {
            base.OnBindingContextChanged();
            LinesModel model = (LinesModel)this.BindingContext;

            if (model != null)
            {
                lblLine.Text = model.Linea;
            }
        }
        public void Setup()
        {
            m_Lines = CreateLines();

            m_Manager = Substitute.For <ILinesSourceManager>();
            m_Manager.Lines.Returns(m_Lines);

            m_Logger = Substitute.For <ILogger>();
            m_Bus = Substitute.For <IBus>();
            m_Manager = Substitute.For <ILinesSourceManager>();
            m_Factory = Substitute.For <IDisplayLineFactory>();

            m_Model = new LinesModel(m_Logger,
                                     m_Bus,
                                     m_Manager,
                                     m_Factory);
        }
 void LstLines_ItemSelected(object sender, SelectedItemChangedEventArgs e)
 {
     try
     {
         LinesModel model = (LinesModel)e.SelectedItem;
         if (model != null)
         {
             selectedLine         = model;
             lblSelectedLine.Text = model.Linea;
         }
         //await Navigation.PushAsync(new DetailPage(inspectorModel));
     }
     catch (Exception pException)
     {
         System.Diagnostics.Debug.WriteLine("LstLines_ItemSelected : " + pException.Message);
     }
     finally
     {
         GC.Collect();
     }
 }
Beispiel #4
0
 public List <LinesModel> GetAll()
 {
     try
     {
         LinesDataLayerRealm    dl     = new LinesDataLayerRealm();
         List <LinesModel>      list   = new List <LinesModel>();
         List <LinesRealmModel> models = dl.GetAll();
         foreach (LinesRealmModel model in models)
         {
             LinesModel realmModel = new LinesModel();
             realmModel.Linea   = model.Linea;
             realmModel.IDLinea = model.IDLinea;
             list.Add(realmModel);
         }
         //list = list.OrderBy(x => x.a_descrizione).ToList();
         return(list);
     }
     catch (Exception pException)
     {
         System.Diagnostics.Debug.WriteLine("Error LinesBusiness->GetAll " + pException.Message);
     }
     return(null);
 }
        public void ConstructorLoadsLinesTest()
        {
            m_Manager.Lines.Returns(m_Lines);

            var model = new LinesModel(m_Logger,
                                       m_Bus,
                                       m_Manager,
                                       m_Factory);

            Assert.AreEqual(m_Lines.Count(),
                            model.Lines.Count());

            model.Dispose();
        }
        public void DisposeCallsReleaseDisplayLinesTest()
        {
            m_Manager.Lines.Returns(m_Lines);

            var model = new LinesModel(m_Logger,
                                       m_Bus,
                                       m_Manager,
                                       m_Factory);

            model.Dispose();

            int count = m_Lines.Count();

            m_Factory.Received(count).Release(Arg.Any <IDisplayLine>());
        }