Exemple #1
0
        private void TabItem_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var tabItem = ((sender as TabControl).SelectedItem) as TabItem;

            if (null == tabItem)
            {
                return;
            }
            if (tabItem.Name == "tabItemOrigin")
            {
                this.tabItemOrigin.IsSelected = true;
                this.CustomViewportViewModel.SelectedViewportItem =
                    this.CustomViewportViewModel.SelectedViewportItemOrigin;
            }
            else if (tabItem.Name == "tabItemUser")
            {
                this.tabItemUser.IsSelected = true;
                this.CustomViewportViewModel.SelectedViewportItem =
                    this.CustomViewportViewModel.SelectedViewportItemUser;
            }
            if (this.CustomViewportViewModel.SelectedViewportItem == null)
            {
                return;
            }
            using (var sr = new StreamReader(this.CustomViewportViewModel.SelectedViewportItem.CustomViewportLayoutXmlPath))
            {
                var layout = new FilmLayout(sr.ReadToEnd(), this.CustomViewportViewModel.SelectedViewportItem.CustomViewportName);
                layout.LayoutType = this.CustomViewportViewModel.SelectedViewportItem.LayoutType;
                ActiveFilmLayout  = layout;
            }
        }
Exemple #2
0
        public void CloneTest()
        {
            FilmLayout target = new FilmLayout(3, 2, "3x2");
            //Clone FilmLayout
            FilmLayout actual;

            actual = target.Clone();
            Assert.IsNotNull(actual);

            //Clone FilmLayout(layoutName, layoutXmlFileStream)
            string layoutXmlFileStream = "testXml";

            target = target = new FilmLayout(layoutXmlFileStream);
            actual = target.Clone();
            Assert.AreEqual(target.LayoutName, actual.LayoutName);
            Assert.AreEqual(target.LayoutXmlFileStream, actual.LayoutXmlFileStream);

            //Clone FilmLayout(layoutName, layoutRowsSize, layoutColumnsSize)
            int layoutRowsSize    = 1;
            int layoutColumnsSize = 2;

            target = new FilmLayout(layoutRowsSize, layoutColumnsSize);
            actual = target.Clone();
            Assert.AreEqual(target.LayoutName, actual.LayoutName);
            Assert.AreEqual(target.LayoutRowsSize, actual.LayoutRowsSize);
            Assert.AreEqual(target.LayoutColumnsSize, actual.LayoutColumnsSize);
        }
        private void ApplySettingButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                Logger.LogFuncUp();

                if (PreWarning())
                {
                    return;
                }

                CustomCellLayout = new FilmLayout(CustomCellRows, CustomCellColumns)
                {
                    LayoutType = LayoutTypeEnum.StandardLayout
                };

                if (CustomCellLayout != null)
                {
                    var eventArgs = new CustomCelllLayoutChangeEventArgs(CustomCellLayout);

                    RaiseCustomCellLayoutChanged(this, eventArgs);
                }

                //Hide();
                //WindowHostManagerWrapper.CloseSecondaryWindow();
                this.CloseParentDialog();

                Logger.LogFuncDown();
            }
            catch (Exception ex)
            {
                Logger.LogFuncException(ex.Message + ex.StackTrace);
            }
        }
Exemple #4
0
        public void FilmLayoutConstructorTest3()
        {
            string layoutXmlFileStream = "testXml";

            FilmLayout target = new FilmLayout(layoutXmlFileStream);

            Assert.IsNotNull(target);
        }
Exemple #5
0
        public void ToStringTest()
        {
            FilmLayout target   = new FilmLayout(3, 2, "test");
            string     expected = "test";
            string     actual;

            actual = target.ToString();
            Assert.AreEqual(expected, actual);
        }
Exemple #6
0
        public void FilmLayoutConstructorTest1()
        {
            int layoutRowsSize    = 1;
            int layoutColumnsSize = 2;

            FilmLayout target = new FilmLayout(layoutRowsSize, layoutColumnsSize);

            Assert.IsNotNull(target);
        }
Exemple #7
0
        public void UpdateButtonStatus(int index, int row, int col)
        {
            if (row <= 0 || col <= 0 || row > FilmLayout.MaxRowCount || col > FilmLayout.MaxColCount)
            {
                return;
            }

            if (index > 0 && index <= _cellLayouts.Count)
            {
                _cellLayouts[index - 1] = new FilmLayout(row, col);
            }
            UpdateCellLayoutButton(index, row, col);
        }
Exemple #8
0
 public void SetFilmLayoutBetween(FilmLayout filmLayout, int startPageIndex, int endPageIndex)
 {
     if (startPageIndex > endPageIndex)
     {
         return;
     }
     for (int i = startPageIndex; i < endPageIndex; i++)
     {
         if (this[i].ViewportLayout != filmLayout)
         {
             this[i].ViewportLayout = filmLayout;
         }
     }
 }
Exemple #9
0
 public void CapturedFilmLayoutTest()
 {
     try
     {
         CustomViewportLayoutWindow target = new CustomViewportLayoutWindow(); //
         FilmLayout expected = null;                                           //
         FilmLayout actual;
         target.CapturedFilmLayout = expected;
         actual = target.CapturedFilmLayout;
         Assert.AreEqual(expected, actual);
         //Assert.Inconclusive("Verify the correctness of this test method.");
     }
     catch (Exception)
     {
     }
 }
Exemple #10
0
        public void LayoutXmlFileStreamTest()
        {
            //PrivateType type = new PrivateType(typeof(FilmLayout));                             //Class1为要测试的类。
            //PrivateObject param0 = new PrivateObject(new FilmLayout(3, 2, "3x2"), type);

            //FilmLayout_Accessor target = new FilmLayout_Accessor(param0);
            //string expected = "test";
            //string actual;
            //target.LayoutXmlFileStream = expected;
            //actual = target.LayoutXmlFileStream;
            //Assert.AreEqual(expected, actual);
            FilmLayout target   = new FilmLayout(3, 2, "3x2");
            string     expected = "test";
            string     actual;

            target.LayoutXmlFileStream = expected;
            actual = target.LayoutXmlFileStream;
            Assert.AreEqual(expected, actual);
        }
Exemple #11
0
        public void LayoutTypeTest()
        {
            //PrivateType type = new PrivateType(typeof(FilmLayout));                             //Class1为要测试的类。
            //PrivateObject param0 = new PrivateObject(new FilmLayout(3, 2, "3x2"), type);

            //FilmLayout_Accessor target = new FilmLayout_Accessor(param0);
            //LayoutTypeEnum expected = new LayoutTypeEnum();
            //LayoutTypeEnum actual;
            //target.LayoutType = expected;
            //actual = target.LayoutType;
            //Assert.AreEqual(expected, actual);
            FilmLayout     target   = new FilmLayout(3, 2, "3x2");
            LayoutTypeEnum expected = new LayoutTypeEnum();
            LayoutTypeEnum actual;

            target.LayoutType = expected;
            actual            = target.LayoutType;
            Assert.AreEqual(expected, actual);
        }
        private bool ApplytoDefaultLayout()
        {
            if (!FilmLayout.DefinedFilmRegionLayoutList.Any())
            {
                return(false);
            }
            var defaultLayout = FilmLayout.DefinedFilmRegionLayoutList.First();

            if (CustomCellColumns == 0 || CustomCellRows == 0)
            {
                return(false);
            }
            if (defaultLayout.LayoutColumnsSize == CustomCellColumns && defaultLayout.LayoutRowsSize == CustomCellRows)
            {
                return(true);
            }
            Environment.Instance.GetDefaultLayoutConfigure().WriteBackToDefaultLayout(CustomCellRows, CustomCellColumns);
            return(FilmLayout.RefreshDefaultLayout(CustomCellRows, CustomCellColumns));
        }
Exemple #13
0
 private void customViewportListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (this.CustomViewportViewModel.SelectedViewportItem == null)
         {
             return;
         }
         using (var sr = new StreamReader(this.CustomViewportViewModel.SelectedViewportItem.CustomViewportLayoutXmlPath))
         {
             var layout = new FilmLayout(sr.ReadToEnd(), this.CustomViewportViewModel.SelectedViewportItem.CustomViewportName);
             layout.LayoutType = this.CustomViewportViewModel.SelectedViewportItem.LayoutType;
             ActiveFilmLayout  = layout;
         }
         e.Handled = true;
     }
     catch (Exception exp)
     {
         Logger.LogError("Exception in customViewportListBox_SelectionChanged: " + exp.Message);
         //throw;
     }
 }
Exemple #14
0
        public void CustomCellLayoutTest()
        {
            try
            {
                PrivateType            type       = new PrivateType(typeof(CustomCellLayoutWindow));
                CustomCellLayoutWindow target     = new CustomCellLayoutWindow(); //
                PrivateObject          privateObj = new PrivateObject(target, type);

                //CustomCellLayoutWindow_Accessor target = new CustomCellLayoutWindow_Accessor(param0); //
                FilmLayout expected = null; //
                FilmLayout actual;
                //target.CustomCellLayout = expected;
                object[] myArgs = new object[] { expected };
                //privateObj.Invoke("CustomCellLayout", myArgs);
                actual = target.CustomCellLayout;
                Assert.AreEqual(expected, actual);
            }
            catch (Exception)
            {
                return;
            }
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
Exemple #15
0
 public CustomViewportChangeEventArgs(FilmLayout customFilmViewport)
 {
     CustomFilmViewport = customFilmViewport;
 }
Exemple #16
0
        public void FilmLayoutConstructorTest2()
        {
            FilmLayout target = new FilmLayout(3, 2, "3x2");

            Assert.IsNotNull(target);
        }
Exemple #17
0
        public FilmingLayoutCellModel(FilmingLayoutCell cell)
        {
            DisplayDatas = cell.Children.OfType <FilmingControlCell>().ToList().ConvertAll(c => c.Image.CurrentPage);

            Layout = new FilmLayout(cell.Rows, cell.Columns);
        }
 public CustomCelllLayoutChangeEventArgs(FilmLayout customFilmLayout)
 {
     CustomFilmLayout = customFilmLayout;
 }