Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Grid"/> class.
        /// </summary>
        public Grid()
        {
            Pair = MXContainer.Resolve <IGrid>();

            NativeElement.HorizontalAlignment = HorizontalAlignment.Stretch;
            NativeElement.VerticalAlignment   = VerticalAlignment.Stretch;
        }
Esempio n. 2
0
        /// <summary>
        /// Adds the stack to this pane manager.
        /// </summary>
        /// <param name="stack">The history stack to add to the manager.</param>
        /// <param name="context">The navigation context that describes the stack position.</param>
        public void AddStack(IHistoryStack stack, iApp.AppNavigationContext context)
        {
            if (HistoryStacks.ContainsKey(context.GetHashCode()))
            {
                HistoryStacks[context.GetHashCode()] = stack;
            }
            else
            {
                HistoryStacks.Add(context.GetHashCode(), stack);
            }

            if (stack != null && stack.FindPane() == Pane.Detail)
            {
                var root = stack.Views.FirstOrDefault();
                var view = (root as IView) ?? MXContainer.Resolve <IView>();
                if (view != null)
                {
                    view.HeaderColor = iApp.Instance.Style.HeaderColor;
                    view.SetBackground(iApp.VanityImagePath, ContentStretch.None);
                    if (root == null)
                    {
                        stack.PushView(view);
                    }
                    else
                    {
                        stack.ReplaceView(root, view);
                    }
                }
            }
        }
Esempio n. 3
0
        public static void Initialize(MXApplication theApp, Context applicationContext)
        {
            MXContainer.InitializeContainer(new MXDroidContainer(theApp));
            MXContainer.Instance.ThreadedLoad = true;

            ApplicationContext = applicationContext;
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes this instance with platform-specific implementations.
        /// </summary>
        public override void Initialize()
        {
            DirectorySeparatorChar = Path.DirectorySeparatorChar;
            string path = string.Concat(BasePath, "\\");

            if (Environment.OSVersion.Platform != PlatformID.WinCE)
            {
                path = path.Substring(FileUriLength, path.Length - FileUriLength);
            }
            ApplicationPath = path;
            path            = BasePath + DataSubFolder;
            if (Environment.OSVersion.Platform != PlatformID.WinCE)
            {
                path = path.Substring(FileUriLength, path.Length - FileUriLength);
            }
            DataPath = path;

            MXContainer.RegisterSingleton <ICompositor>(typeof(GdiPlusCompositor));
            MXContainer.RegisterSingleton <IFile>(typeof(BasicFile));
            MXContainer.RegisterSingleton <ILog>(typeof(BasicLogger), () => new BasicLogger(Path.Combine(SessionDataPath, "Log")));
            MXContainer.RegisterSingleton <IThread>(typeof(CompactFrameworkThread));
            MXContainer.RegisterSingleton <IReflector>(typeof(CompactReflector));
            MXContainer.RegisterSingleton <IResources>(typeof(BasicResources));
            Platform = MobilePlatform.WindowsMobile;
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes the singleton device instance.
        /// </summary>
        /// <param name="newInstance">The singleton device instance.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="newInstance"/> is <c>null</c>.</exception>
        public static void Initialize(Device newInstance)
        {
            if (newInstance == null)
            {
                throw new ArgumentNullException();
            }

            MXContainer.RegisterSingleton <IImageCache>(typeof(ImageCache));
            MXContainer.RegisterSingleton <INetwork>(typeof(NetworkAsynch));
            MXContainer.RegisterSingleton <ILog>(typeof(DiagnosticDebugLogger));
            MXContainer.RegisterSingleton <IEncryption>(typeof(MockEncryption));
            MXContainer.RegisterSingleton <IFile>(typeof(NullFile));
            MXContainer.RegisterSingleton <IThread>(typeof(NullThread));
            MXContainer.RegisterSingleton <IReflector>(typeof(NullReflector));
            MXContainer.RegisterSingleton <Resources.IResources>(typeof(Resources.NullResources));
            MXContainer.RegisterSingleton <ImageComposition.ICompositor>(typeof(ImageComposition.NullCompositor));

            Instance = newInstance;
            Instance.SessionDataRoot = DataPath.AppendPath("session");
            Instance.Initialize();
            if (!File.Exists(SessionDataPath))
            {
                File.CreateDirectory(SessionDataPath);
            }
        }
 public override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     //Register view for model updates
     MXContainer.AddView <List <Customer> >(this);
     SetHasOptionsMenu(true);
 }
Esempio n. 7
0
        /// <summary>
        /// Initializes the singleton device instance.
        /// </summary>
        /// <param name="newInstance">The singleton device instance.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="newInstance"/> is <c>null</c>.</exception>
        public static void Initialize(Device newInstance)
        {
            if (newInstance == null)
            {
                throw new ArgumentNullException();
            }

            MXContainer.RegisterSingleton <IThread>(typeof(BasicThread));
            MXContainer.RegisterSingleton <IThread>(typeof(MockThread), ThreadType.MockThread.ToString());

            MXContainer.RegisterSingleton <INetwork>(typeof(NetworkAsynch));
            MXContainer.RegisterSingleton <INetwork>(typeof(NetworkSynch), NetworkType.NetworkSynch.ToString());

            MXContainer.RegisterSingleton <IImageCache>(typeof(ImageCache));
            MXContainer.RegisterSingleton <IFile>(typeof(BasicFile));
            MXContainer.RegisterSingleton <Resources.IResources>(typeof(Resources.BasicResources));
            MXContainer.RegisterSingleton <IReflector>(typeof(BasicReflector));
            MXContainer.RegisterSingleton <ILog>(typeof(BasicLogger), args =>
            {
                var path = args.Length > 0 ? args[0] as string : null;
                return(new BasicLogger(path ?? SessionDataPath.AppendPath("Log")));
            });

            MXContainer.RegisterSingleton <IEncryption>(typeof(MockEncryption));
            MXContainer.RegisterSingleton <ImageComposition.ICompositor>(typeof(ImageComposition.NullCompositor));

            Instance = newInstance;
            Instance.Initialize();
            File.EnsureDirectoryExistsForFile(SessionDataPath.AppendPath("Log"));
        }
Esempio n. 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="iFactr.UI.Controls.Image"/> class.
        /// </summary>
        /// <param name="imageData">The in-memory data of the image.  This data will not be cached automatically
        /// and must be added to the cache manually if caching is desired.</param>
        public Image(IImageData imageData)
        {
            Pair = MXContainer.Resolve <IImage>(null, imageData);

            NativeControl.HorizontalAlignment = HorizontalAlignment.Left;
            NativeControl.VerticalAlignment   = VerticalAlignment.Top;
        }
Esempio n. 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="iFactr.UI.Toolbar"/> class.
        /// </summary>
        public Toolbar()
        {
            Pair = MXContainer.Resolve <IToolbar>();

            pair.BackgroundColor = new Color();
            pair.ForegroundColor = new Color();
        }
Esempio n. 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="iFactr.UI.TabItem"/> class.
        /// </summary>
        public TabItem()
        {
            Pair = MXContainer.Resolve <ITabItem>();

            pair.TitleColor = new Color();
            pair.TitleFont  = Font.PreferredTabFont;
        }
Esempio n. 11
0
        public static void Initialize(MXApplication theApp)
        {
            MXContainer.InitializeContainer(new MXConsoleContainer(theApp));

            // non-threaded container, not needed as all input is blocking (old-school)
            MXContainer.Instance.ThreadedLoad = false;
        }
Esempio n. 12
0
        public static void Initialize(MXApplication theApp, Frame navFrame)
        {
            MXContainer.InitializeContainer(new MXWindowsContainer(theApp));
            MXContainer.Instance.ThreadedLoad = false;

            NavigationFrame = navFrame;
        }
Esempio n. 13
0
            public override bool ShouldSelectViewController(UITabBarController tabBarController, UIViewController viewController)
            {
                UINavigationController navController = viewController as UINavigationController;

                Debug.WriteLine("TabBarControllerDelegate:ShouldSelectViewController");

                if (navController.ViewControllers.Length == 0)
                {
                    int index = Array.IndexOf(tabBarController.ViewControllers, viewController);
                    if (index >= 0)
                    {
                        Type   viewType  = _parent._viewGroup.Items[index].ViewType;
                        var    modelType = MXContainer.Instance.Views.FirstOrDefault(v => v.Value == viewType).Key;
                        string pattern   = MXContainer.Instance.App.NavigationMap.GetPatternForModelType(modelType);
                        MXContainer.Navigate(null, pattern);
                    }
                }
                else
                {
                    // do nothing, tab has a view, leave it for the contained view to figure out what needs
                    // to be done
                }

                return(true);
            }
Esempio n. 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="iFactr.UI.BrowserView&lt;T&gt;"/> class.
        /// </summary>
        public BrowserView()
        {
            Pair = MXContainer.Resolve <IBrowserView>();

            NativeView.ShouldNavigate           = ShouldNavigateFrom;
            NativeView.PopoverPresentationStyle = PopoverPresentationStyle.Normal;
        }
Esempio n. 15
0
        public static void Initialize(MXApplication theApp)
        {
            MXContainer.InitializeContainer(new MXWebkitContainer(theApp));

            // no threading in web generation, not needed as all output
            // is on the server and synchronous anyway
            MXContainer.Instance.ThreadedLoad = false;
        }
Esempio n. 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="iFactr.UI.Alert"/> class.
 /// </summary>
 /// <param name="message">The message to display with the alert.</param>
 /// <param name="title">The title of the alert.</param>
 /// <param name="buttons">The button combination for the alert.</param>
 public Alert(string message, string title, AlertButtons buttons)
 {
     nativeAlert = MXContainer.Resolve <IAlert>(null, message, title, buttons);
     if (nativeAlert == null)
     {
         throw new InvalidOperationException("No native object was found for the current instance.");
     }
 }
Esempio n. 17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="iFactr.UI.GridCell"/> class.
        /// </summary>
        public GridCell()
        {
            base.Pair = MXContainer.Resolve <IGridCell>();

            NativeCell.Padding        = new Thickness(Thickness.LeftMargin, Thickness.TopMargin, Thickness.RightMargin, Thickness.BottomMargin);
            NativeCell.SelectionColor = iApp.Instance.Style.SelectionColor;
            NativeCell.SelectionStyle = SelectionStyle.Default;
        }
Esempio n. 18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SectionFooter"/> class.
        /// </summary>
        public SectionFooter()
        {
            Pair = MXContainer.Resolve <ISectionFooter>();

            pair.BackgroundColor = iApp.Instance.Style.SectionHeaderColor;
            pair.ForegroundColor = iApp.Instance.Style.SectionHeaderTextColor;
            pair.Font            = Font.PreferredSectionFooterFont;
        }
Esempio n. 19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="iFactr.UI.SearchBox"/> class.
        /// </summary>
        public SearchBox()
        {
            Pair = MXContainer.Resolve <ISearchBox>();

            pair.BackgroundColor = new Color();
            pair.BorderColor     = new Color();
            pair.ForegroundColor = new Color();
        }
Esempio n. 20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="iFactr.UI.Menu"/> class.
        /// </summary>
        public Menu()
        {
            Pair = MXContainer.Resolve <IMenu>();

            pair.BackgroundColor = iApp.Instance.Style.HeaderColor;
            pair.ForegroundColor = iApp.Instance.Style.HeaderTextColor;
            pair.SelectionColor  = new Color();
        }
Esempio n. 21
0
        public MXFormsContainer(MXApplication app, NavigationPage navigationPage, Action <Task> onInitializationFinished = null) : base(app)
        {
            this.formsNavigation          = new MXFormsNavigation(navigationPage);
            this.onInitializationFinished = onInitializationFinished;

            MXContainer.InitializeContainer(this);
            startApplication();
        }
Esempio n. 22
0
        private static void NavigateImpl <T>(IMXView view, string actionName, IDictionary <string, string> parameterValues)
            where T : IMXConventionBasedController
        {
            var url = MXConventionBasedController.ControllerAnalyser.GenerateUrlFor(typeof(T), actionName,
                                                                                    parameterValues);

            MXContainer.Navigate(view, url);
        }
Esempio n. 23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="iFactr.UI.Controls.Image"/> class.
        /// </summary>
        /// <param name="filePath">The full path of the file for the image.</param>
        /// <param name="options">Additional options to apply to the image during creation.</param>
        public Image(string filePath, ImageCreationOptions options)
        {
            Pair = MXContainer.Resolve <IImage>(null, options);

            NativeControl.HorizontalAlignment = HorizontalAlignment.Left;
            NativeControl.VerticalAlignment   = VerticalAlignment.Top;
            NativeControl.FilePath            = filePath;
        }
Esempio n. 24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="iFactr.UI.CanvasView&lt;T&gt;"/> class.
        /// </summary>
        public CanvasView()
        {
            Pair = MXContainer.Resolve <ICanvasView>();

            NativeView.ShouldNavigate           = ShouldNavigateFrom;
            NativeView.StrokeColor              = new Color();
            NativeView.PopoverPresentationStyle = PopoverPresentationStyle.Normal;
        }
Esempio n. 25
0
        void listBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var b = e.AddedItems[0] as Book;

            if (b != null)
            {
                MXContainer.Navigate(this, string.Format("{0}/{1}", b.CategoryEncoded, b.ISBN));
            }
        }
Esempio n. 26
0
        public static void Initialize(MXApplication theApp, UIApplicationDelegate appDelegate, UIWindow window)
        {
            // initialize the application and hold a reference for a bit
            MXSlideoutContainer thisContainer = new MXSlideoutContainer(theApp, appDelegate, window);

            MXContainer.InitializeContainer(thisContainer);

            thisContainer.StartApplication();
        }
Esempio n. 27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="iFactr.UI.Controls.Label"/> class.
        /// </summary>
        public Label()
        {
            Pair = MXContainer.Resolve <ILabel>();

            NativeControl.Font                = Font.PreferredLabelFont;
            NativeControl.ForegroundColor     = iApp.Instance.Style.TextColor;
            NativeControl.HorizontalAlignment = HorizontalAlignment.Stretch;
            NativeControl.VerticalAlignment   = VerticalAlignment.Stretch;
        }
Esempio n. 28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="iFactr.UI.Controls.Button"/> class.
        /// </summary>
        public Button()
        {
            Pair = MXContainer.Resolve <IButton>();

            NativeControl.BackgroundColor     = new Color();
            NativeControl.ForegroundColor     = iApp.Instance.Style.TextColor;
            NativeControl.Font                = Font.PreferredButtonFont;
            NativeControl.HorizontalAlignment = HorizontalAlignment.Left;
            NativeControl.VerticalAlignment   = VerticalAlignment.Top;
        }
Esempio n. 29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="iFactr.UI.Controls.TimePicker"/> class.
        /// </summary>
        public TimePicker()
        {
            Pair = MXContainer.Resolve <ITimePicker>();

            NativeControl.BackgroundColor     = new Color();
            NativeControl.Font                = Font.PreferredDateTimePickerFont;
            NativeControl.ForegroundColor     = new Color();
            NativeControl.HorizontalAlignment = HorizontalAlignment.Left;
            NativeControl.VerticalAlignment   = VerticalAlignment.Top;
        }
Esempio n. 30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="iFactr.UI.Controls.TextArea"/> class.
        /// </summary>
        public TextArea()
        {
            Pair = MXContainer.Resolve <ITextArea>();

            NativeControl.BackgroundColor     = new Color();
            NativeControl.ForegroundColor     = new Color();
            NativeControl.Font                = Font.PreferredTextBoxFont;
            NativeControl.HorizontalAlignment = HorizontalAlignment.Stretch;
            NativeControl.VerticalAlignment   = VerticalAlignment.Stretch;
        }