示例#1
0
        internal async Task AddStoryAsync(string name, string theAbstract)
        {
            var story = new StoryItem()
            {
                Name     = name,
                StreamId = this.Id,
                Abstract = theAbstract,
                IsActive = true
            };

            var conn = KanblogRuntime.GetConnection();
            await conn.InsertAsync(story);
        }
示例#2
0
文件: Entity.cs 项目: mbrit/Kanblog
        internal async Task SaveChangesAsync()
        {
            var conn = KanblogRuntime.GetConnection();

            if (this.IsNew)
            {
                await conn.InsertAsync(this);
            }
            else
            {
                await conn.UpdateAsync(this);
            }
        }
示例#3
0
        private static async Task <int> GetNextOrdinalAsync()
        {
            var conn = KanblogRuntime.GetConnection();

            if (await conn.Table <StreamItem>().FirstOrDefaultAsync() != null)
            {
                return(await conn.ExecuteScalarAsync <int>("select max(ordinal) from streamitem") + 1000);
            }
            else
            {
                return(1000);
            }
        }
示例#4
0
文件: App.xaml.cs 项目: mbrit/Kanblog
 void settings_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
 {
     args.Request.ApplicationCommands.Add(new SettingsCommand("GitHubSource", "GitHub Source", async(e) =>
     {
         await KanblogRuntime.OpenUriAsync(new Uri("https://github.com/mbrit/Kanblog"));
     }));
     args.Request.ApplicationCommands.Add(new SettingsCommand("About", "About", async(e) =>
     {
         var version = Package.Current.Id.Version;
         var dialog  = new MessageDialog(string.Format("A Kanban-style tool for blog story planning\r\nVersion {0}.{1}.{2}.{3}\r\nUses the MetroLog and sqlite-net libraries, and the SQLite database\r\nLicenced under the MIT license - https://github.com/mbrit/Kanblog",
                                                       version.Major, version.Minor, version.Build, version.Revision), "Kanblog");
         await dialog.ShowAsync();
     }));
 }
示例#5
0
        private static async Task <StreamItem> CreateStreamAsync(string name, bool isDefault = false)
        {
            var stream = new StreamItem()
            {
                Name      = name,
                Ordinal   = await GetNextOrdinalAsync(),
                IsDefault = isDefault,
                IsActive  = true
            };

            var conn = KanblogRuntime.GetConnection();
            await conn.InsertAsync(stream);

            return(stream);
        }
示例#6
0
文件: App.xaml.cs 项目: mbrit/Kanblog
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            // boot...
            await KanblogRuntime.StartAsync();

            // navigate...
            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(StreamsPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();

            // setup...
            this.ConfigureSettings();
            this.ConfigureSharing();
        }
示例#7
0
        internal async Task <IEnumerable <StoryItem> > GetActiveStoriesAsync()
        {
            var conn = KanblogRuntime.GetConnection();

            return(await conn.Table <StoryItem>().Where(v => v.StreamId == this.Id && v.IsActive).ToListAsync());
        }
示例#8
0
        public static async Task <IEnumerable <StreamItem> > GetActiveStreamsAsync()
        {
            var conn = KanblogRuntime.GetConnection();

            return(await conn.Table <StreamItem>().Where(v => v.IsActive).OrderBy(v => v.Ordinal).ToListAsync());
        }
示例#9
0
        internal static async Task <StreamItem> GetDefaultStreamAsync()
        {
            var conn = KanblogRuntime.GetConnection();

            return(await conn.Table <StreamItem>().Where(v => v.IsDefault).FirstAsync());
        }