Beispiel #1
0
 public void FireTapEvent(AppBarItem item, object sender)
 {
     if (EventHolder.ContainsKey(item))
     {
         EventHolder[item].Invoke(sender, new RoutedEventArgs());
     }
 }
Beispiel #2
0
 public CommandBarManager Disable(AppBarItemType type, AppBarItem item)
 {
     if (EnabledItems[type].Contains(item))
     {
         EnabledItems[type].Remove(item);
     }
     return(this);
 }
Beispiel #3
0
 private CommandBarManager Enable(AppBarItemType type, AppBarItem item)
 {
     if (!EnabledItems[type].Contains(item))
     {
         EnabledItems[type].Add(item);
     }
     return(this);
 }
Beispiel #4
0
        private AppBarButton NewButtonWithHandler(AppBarItem item)
        {
            var button = NewButton(item);

            if (EventHolder.ContainsKey(item))
            {
                button.Click += EventHolder[item];
            }
            DebugUtil.Log(() => "Creating button: " + item + " " + button.Visibility);
            return(button);
        }
Beispiel #5
0
 public bool IsEnabled(AppBarItemType type, AppBarItem item)
 {
     return(EnabledItems[type].Contains(item));
 }
Beispiel #6
0
 /// <summary>
 /// Add an item to show left end of command bar.
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public CommandBarManager DeviceDependent(AppBarItem item)
 {
     return(Enable(AppBarItemType.DeviceDependent, item));
 }
Beispiel #7
0
 public CommandBarManager HiddenItem(AppBarItem item)
 {
     return(Enable(AppBarItemType.Hidden, item));
 }
Beispiel #8
0
 /// <summary>
 /// Add an item to show right end of the bar.
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public CommandBarManager Command(AppBarItem item)
 {
     return(Enable(AppBarItemType.Command, item));
 }
Beispiel #9
0
        private static AppBarButton NewButton(AppBarItem item)
        {
            switch (item)
            {
            case AppBarItem.CancelTouchAF:
                return(new AppBarButton()
                {
                    ContentTemplate = (DataTemplate)Application.Current.Resources["CancelIcon"], Label = SystemUtil.GetStringResource("AppBar_CancelTouchAf")
                });

            case AppBarItem.Close:
                return(new AppBarButton()
                {
                    Icon = new SymbolIcon(Symbol.Cancel), Label = SystemUtil.GetStringResource("AppBar_Close")
                });

            case AppBarItem.DeleteMultiple:
                return(new AppBarButton()
                {
                    Icon = new SymbolIcon(Symbol.Delete), Label = SystemUtil.GetStringResource("AppBar_Delete")
                });

            case AppBarItem.DownloadMultiple:
                return(new AppBarButton()
                {
                    Icon = new SymbolIcon(Symbol.Download), Label = SystemUtil.GetStringResource("AppBar_Download")
                });

            case AppBarItem.ShowDetailInfo:
                return(new AppBarButton()
                {
                    Icon = new SymbolIcon(Symbol.OpenPane)
                    {
                        RenderTransform = new ScaleTransform {
                            ScaleX = -1
                        }, RenderTransformOrigin = new Point {
                            X = 0.5, Y = 0.5
                        }
                    }, Label = SystemUtil.GetStringResource("ShowDetailInfo")
                });

            case AppBarItem.HideDetailInfo:
                return(new AppBarButton()
                {
                    Icon = new SymbolIcon(Symbol.ClosePane)
                    {
                        RenderTransform = new ScaleTransform {
                            ScaleX = -1
                        }, RenderTransformOrigin = new Point {
                            X = 0.5, Y = 0.5
                        }
                    }, Label = SystemUtil.GetStringResource("HideDetailInfo")
                });

            case AppBarItem.Ok:
                return(new AppBarButton()
                {
                    Icon = new SymbolIcon(Symbol.Accept), Label = SystemUtil.GetStringResource("AppBar_Exit")
                });

            case AppBarItem.Donation:
                return(new AppBarButton()
                {
                    Icon = new SymbolIcon(Symbol.Like), Label = SystemUtil.GetStringResource("Donation")
                });

            case AppBarItem.RotateLeft:
                return(new AppBarButton()
                {
                    Icon = new SymbolIcon(Symbol.Rotate)
                    {
                        RenderTransform = new ScaleTransform {
                            ScaleX = -1
                        }, RenderTransformOrigin = new Point {
                            X = 0.5, Y = 0.5
                        }
                    }, Label = SystemUtil.GetStringResource("RotateLeft")
                });

            case AppBarItem.RotateRight:
                return(new AppBarButton()
                {
                    Icon = new SymbolIcon(Symbol.Rotate), Label = SystemUtil.GetStringResource("RotateRight")
                });

            case AppBarItem.FNumberSlider:
                return(new AppBarButton()
                {
                    ContentTemplate = (DataTemplate)Application.Current.Resources["ApertureIcon"], Label = SystemUtil.GetStringResource("CommandBar_Fnumber")
                });

            case AppBarItem.ShutterSpeedSlider:
                return(new AppBarButton()
                {
                    ContentTemplate = (DataTemplate)Application.Current.Resources["SSIcon"], Label = SystemUtil.GetStringResource("CommandBar_SS")
                });

            case AppBarItem.IsoSlider:
                return(new AppBarButton()
                {
                    ContentTemplate = (DataTemplate)Application.Current.Resources["IsoIcon"], Label = SystemUtil.GetStringResource("CommandBar_ISO")
                });

            case AppBarItem.ProgramShiftSlider:
                return(new AppBarButton()
                {
                    ContentTemplate = (DataTemplate)Application.Current.Resources["ProgramShiftIcon"], Label = SystemUtil.GetStringResource("CommandBar_PShift")
                });

            case AppBarItem.EvSlider:
                return(new AppBarButton()
                {
                    ContentTemplate = (DataTemplate)Application.Current.Resources["EvIcon"], Label = SystemUtil.GetStringResource("CommandBar_EV")
                });

            case AppBarItem.Zoom:
                return(new AppBarButton()
                {
                    ContentTemplate = (DataTemplate)Application.Current.Resources["ZoomInIcon"], Label = SystemUtil.GetStringResource("CommandBar_Zoom")
                });

            case AppBarItem.Resume:
                return(new AppBarButton()
                {
                    Icon = new SymbolIcon(Symbol.Play), Label = SystemUtil.GetStringResource("AppBar_Play")
                });

            case AppBarItem.Pause:
                return(new AppBarButton()
                {
                    Icon = new SymbolIcon(Symbol.Pause), Label = SystemUtil.GetStringResource("AppBar_Pause")
                });

            case AppBarItem.LocalStorage:
                return(new AppBarButton()
                {
                    ContentTemplate = (DataTemplate)Application.Current.Resources["ic_phonelink_white"], Label = SystemUtil.GetStringResource("AppBar_LocalStorage")
                });

            case AppBarItem.RemoteStorage:
                return(new AppBarButton()
                {
                    Icon = new SymbolIcon(Symbol.MapDrive), Label = SystemUtil.GetStringResource("AppBar_RemoteStorage")
                });

            case AppBarItem.CancelSelection:
                return(new AppBarButton()
                {
                    Icon = new SymbolIcon(Symbol.Cancel), Label = SystemUtil.GetStringResource("AppBar_Cancel")
                });

            default:
                throw new NotImplementedException();
            }
        }
Beispiel #10
0
 public CommandBarManager SetAccentColor(AppBarItem item)
 {
     Accented.Add(item);
     return(this);
 }
Beispiel #11
0
 public CommandBarManager SetHeartBeat(AppBarItem item)
 {
     HeartBeater.Add(item);
     return(this);
 }
Beispiel #12
0
 public CommandBarManager SetEvent(AppBarItem item, RoutedEventHandler handler)
 {
     EventHolder.Add(item, handler);
     return(this);
 }
Beispiel #13
0
 public CommandBarManager NoIcon(AppBarItem item)
 {
     return(Enable(AppBarItemType.OnlyText, item));
 }
Beispiel #14
0
 public CommandBarManager Icon(AppBarItem item)
 {
     return(Enable(AppBarItemType.WithIcon, item));
 }
Beispiel #15
0
        private static AppBarButton NewButton(AppBarItem item)
        {
            switch (item)
            {
            case AppBarItem.ControlPanel:
                return(new AppBarButton()
                {
                    Icon = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/AppBar/appbar_cameraSetting.png", UriKind.Absolute)
                    }, Label = SystemUtil.GetStringResource("AppBar_ControlPanel")
                });

            case AppBarItem.AppSetting:
                return(new AppBarButton()
                {
                    Icon = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/AppBar/feature.settings.png", UriKind.Absolute)
                    }, Label = SystemUtil.GetStringResource("AppBar_AppSetting")
                });

            case AppBarItem.CancelTouchAF:
                return(new AppBarButton()
                {
                    Icon = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/AppBar/appbar_cancel.png", UriKind.Absolute)
                    }, Label = SystemUtil.GetStringResource("AppBar_CancelTouchAf")
                });

            case AppBarItem.AboutPage:
                return(new AppBarButton()
                {
                    Label = SystemUtil.GetStringResource("About")
                });

            case AppBarItem.LoggerPage:
                return(new AppBarButton()
                {
                    Label = "Logger"
                });

            case AppBarItem.PlaybackPage:
                return(new AppBarButton()
                {
                    Icon = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/AppBar/appbar_playback.png", UriKind.Absolute)
                    }, Label = SystemUtil.GetStringResource("AppBar_CameraRoll")
                });

            case AppBarItem.DeleteMultiple:
                return(new AppBarButton()
                {
                    Icon = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/AppBar/appbar_delete.png")
                    }, Label = SystemUtil.GetStringResource("AppBar_Delete")
                });

            case AppBarItem.DownloadMultiple:
                return(new AppBarButton()
                {
                    Icon = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/AppBar/appbar_download.png")
                    }, Label = SystemUtil.GetStringResource("AppBar_Download")
                });

            case AppBarItem.ShowDetailInfo:
                return(new AppBarButton()
                {
                    Icon = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/AppBar/appbar_display_info.png")
                    }, Label = SystemUtil.GetStringResource("ShowDetailInfo")
                });

            case AppBarItem.HideDetailInfo:
                return(new AppBarButton()
                {
                    Icon = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/AppBar/appbar_close_display.png")
                    }, Label = SystemUtil.GetStringResource("HideDetailInfo")
                });

            case AppBarItem.Ok:
                return(new AppBarButton()
                {
                    Icon = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/AppBar/appbar_ok.png")
                    }, Label = SystemUtil.GetStringResource("AppBar_Exit")
                });

            case AppBarItem.WifiSetting:
                return(new AppBarButton()
                {
                    Icon = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/AppBar/appbar_wifi.png")
                    }, Label = SystemUtil.GetStringResource("WifiSettingLauncherButtonText")
                });

            case AppBarItem.Donation:
                return(new AppBarButton()
                {
                    Icon = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/AppBar/appbar_Dollar.png")
                    }, Label = SystemUtil.GetStringResource("Donation")
                });

            case AppBarItem.RotateLeft:
                return(new AppBarButton()
                {
                    Icon = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/AppBar/appbar_rotateLeft.png")
                    }, Label = SystemUtil.GetStringResource("RotateLeft")
                });

            case AppBarItem.RotateRight:
                return(new AppBarButton()
                {
                    Icon = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/AppBar/appbar_rotateRight.png")
                    }, Label = SystemUtil.GetStringResource("RotateRight")
                });

            case AppBarItem.Refresh:
                return(new AppBarButton()
                {
                    Icon = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/AppBar/sync.png")
                    }, Label = SystemUtil.GetStringResource("AppBar_Refresh")
                });

            default:
                throw new NotImplementedException();
            }
        }