示例#1
0
        public async void setupInitialView()
        {
            await Task.Delay(TimeSpan.FromMilliseconds(2));

            settingsManager = new AccessSettings(cloudSessionHolder);
            cloudSessionHolder.AddSubview(settingsManager.settingsView);
        }
示例#2
0
        /// <summary>
        /// Create the controller.
        /// </summary>
        /// <param name="settings">The northwind settings.</param>
        public AccessController(IOptions <AccessSettings> settings)
        {
            this.Settings = settings.Value;

            this.tables = new Dictionary <string, Type>();

            Assembly assembly = Assembly.GetExecutingAssembly();

            foreach (Type type in assembly.GetTypes())
            {
                if (type.GetCustomAttribute <AccessTableAttribute>() != null)
                {
                    AddTable(type);
                }
            }
        }
示例#3
0
        public void AddNewInvoice()
        {
            InvoiceGroup newGroup = new InvoiceGroup();

            newGroup.DefaultBillFilePath = (string)AccessSettings.GetValue("DefaultBillPath");
            if (DB.OracleSession == null)
            {
                return;
            }
            newGroup.ChangedBy = DB.OracleSession.UserName;

            if (IGroups == null)
            {
                IGroups = new ObservableCollection <InvoiceGroup>();
            }
            IGroups.Add(newGroup);
            CurrentGroupItem = newGroup;
            AddWeakEventListener(CurrentGroupItem, IGroupListener);
            // Make it dirty
            CurrentGroupItem.Description = "Please fill out the description";
        }
示例#4
0
        /// <summary>
        /// Create the status object.
        /// </summary>
        /// <param name="settings">The access settings.</param>
        public SystemStatus(AccessSettings settings)
        {
            this.Requested = DateTime.UtcNow;

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            this.DatabaseTime = AccessWrapper.QueryDatabase <DateTime>(settings, "SELECT Now() AS [Date]", (reader) => {
                DateTime result = DateTime.MinValue;
                if (reader.HasRows)
                {
                    reader.Read();
                    int ordinal = reader.GetOrdinal("Date");
                    result      = reader.GetDateTime(ordinal);
                }
                return(result);
            });

            stopWatch.Stop();

            this.QueryTimeInMilliseconds = stopWatch.ElapsedMilliseconds;
            this.QueryTimeInTicks        = stopWatch.ElapsedTicks;
        }
示例#5
0
        private void TwitterOAuth(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(vm.PINText.Value))
            {
                return;
            }

            tokens           = OAuth.GetTokens(session, vm.PINText.Value);
            vm.PINText.Value = string.Empty;

            if (tokens == null)
            {
                MessageBox.Show("認証に失敗しました");
            }
            else
            {
                MessageBoxResult ret = MessageBox.Show("認証に成功しました。認証情報を保存しますか?", "", MessageBoxButton.YesNo);
                if (ret == MessageBoxResult.Yes)
                {
                    // トークン情報
                    AccessSettings accessSettings = new AccessSettings();
                    accessSettings.UserId      = tokens.UserId;
                    accessSettings.ConsumerKey = tokens.ConsumerKey;
                    accessSettings.ConsumerSec = tokens.ConsumerSecret;
                    accessSettings.AccessKey   = tokens.AccessToken;
                    accessSettings.AccessSec   = tokens.AccessTokenSecret;

                    // バイナリファイル
                    BinaryFormatter      bf = new BinaryFormatter();
                    System.IO.FileStream fs = new System.IO.FileStream(fileName, System.IO.FileMode.Create);
                    bf.Serialize(fs, accessSettings);
                    fs.Close();
                }
            }

            this.Close();
        }
示例#6
0
        private void MetroWindow_ContentRendered(object sender, System.EventArgs e)
        {
            try
            {
                // 設定ファイルが保存済み
                if (System.IO.File.Exists(fileName))
                {
                    // 設定ファイル読み込み
                    BinaryFormatter bf             = new BinaryFormatter();
                    FileStream      fs             = new FileStream(fileName, FileMode.Open);
                    AccessSettings  accessSettings = (AccessSettings)bf.Deserialize(fs);
                    fs.Close();

                    tokens = Tokens.Create(
                        accessSettings.ConsumerKey,
                        accessSettings.ConsumerSec,
                        accessSettings.AccessKey,
                        accessSettings.AccessSec);

                    if (tokens == null)
                    {
                        MessageBox.Show("認証に失敗しました");
                    }
                    else
                    {
                        var userinfo = tokens.Account.VerifyCredentials();
                        vm.CoopTwitterID.Value = userinfo.ScreenName;
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("予期せぬエラーが発生しました");
                return;
            }
        }
示例#7
0
 /// <summary>
 /// Create the controller.
 /// </summary>
 /// <param name="settings">The northwind settings.</param>
 public StatusController(IOptions <AccessSettings> settings)
 {
     this.Settings = settings.Value;
 }