예제 #1
1
        private const double Width = 8.27; // in inches.

        #endregion Fields

        #region Methods

        /// <summary>
        /// Aquire an image from the systems default scanner.
        /// </summary>
        /// <returns>byte array of the image.</returns>
        public static byte[] AquireImage()
        {
            var wiaDlg = new CommonDialog();
            var wiaDevice = wiaDlg.ShowSelectDevice(WiaDeviceType.ScannerDeviceType);

            if (wiaDevice.Items.Count == 1)
            {
                var scanner = wiaDevice.Items[1];

                //scanner.Properties["6146"].set_Value(1);
                scanner.Properties["6147"].set_Value(Dpi); // Horizontal resolution.
                scanner.Properties["6148"].set_Value(Dpi); // Vertical resolution.
                scanner.Properties["6151"].set_Value((int)(Dpi * Width)); // Horizontal extent.
                scanner.Properties["6152"].set_Value((int)(Dpi * Height)); // Vertical extent.
                //wiaDevice.Properties[4170].set_Value(1);

                /*var image =
                    wiaDlg.ShowAcquireImage(WiaDeviceType.ScannerDeviceType, WiaImageIntent.ColorIntent,
                        WiaImageBias.MaximizeQuality, FormatID.wiaFormatBMP, true, false, false);*/

                //scanner.Properties.Item
                var image = (ImageFile)wiaDlg.ShowTransfer(scanner, FormatID.wiaFormatJPEG);
                //var image = (ImageFile)scanner.Transfer();
                return (byte[]) image.FileData.get_BinaryData();
            }

            return null;
        }
        /// <summary>変更処理</summary>
        /// <param name="sender">源</param>
        /// <param name="e">イベント</param>
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            // 入力チェック
            if (!InputCheck())
            {
                return;
            }

            // 編集登録確認ダイアログの表示
            if (MessageBoxResult.Yes == CommonDialog.ShowEditRegistDialog())
            {
                dbAccess           = new DBConnect(LoginSetting.ConnectStr);
                _parameterTableDAO = new ParameterTableDAO(dbAccess);

                // パラメータテーブルをロック
                bool getLockFlag = GetLockForUpd(Consts.WINDOW_600);

                //200秒実行を停止します。
                //System.Threading.Thread.Sleep(200000);

                //bool getLockFlag = true;

                if (getLockFlag == true)
                {
                    RegistProcess();

                    // 修正前データ保存
                    svParamData();
                }
                dbAccess.CloseSqlConnect();
            }
        }
예제 #3
0
    private void OnTappedMAT_0()
    {
        if (!this.CanEnter())
        {
            CMD_ModalMessage cmd_ModalMessage = GUIMain.ShowCommonDialog(null, "CMD_ModalMessage", null) as CMD_ModalMessage;
            cmd_ModalMessage.Title = this.GetTitle();
            cmd_ModalMessage.Info  = this.GetInfoCannotEnter();
            return;
        }
        bool flag = this.CanSelectMonster(0);

        if (flag)
        {
            this.SetBaseSelectType();
            CMD_BaseSelect.ElementType = CMD_BaseSelect.ELEMENT_TYPE.BASE;
            CommonDialog commonDialog = GUIMain.ShowCommonDialog(delegate(int index)
            {
                if (index == 1 && CMD_BaseSelect.DataChg != null)
                {
                    this.baseDigimon   = CMD_BaseSelect.DataChg;
                    this.goBaseDigimon = this.SetSelectedCharChg(this.baseDigimon, this.baseDetail.GetCharaIconObject(), this.goBaseDigimon, 0);
                    this.ShowMATInfo_0();
                    this.ShowCHGInfo();
                    this.BtnCont();
                    this.OnBaseSelected();
                }
            }, "CMD_BaseSelect", null);
            commonDialog.SetForceReturnValue(0);
        }
        else
        {
            this.OpenCanNotSelectMonsterPop();
        }
    }
        public static DialogResult ShowDialogPath(this CommonDialog dlg, string path)
        {
            DialogResult dlgResult;
            var          fileDialog   = dlg as FileDialog;
            var          folderDialog = dlg as FolderBrowserDialog;

            try
            {
                if (fileDialog != null)
                {
                    fileDialog.FileName         = Path.GetFileName(path);
                    fileDialog.InitialDirectory = Path.GetDirectoryName(path);
                }
                else if (folderDialog != null)
                {
                    folderDialog.SelectedPath = path;
                }
                dlgResult = dlg.ShowDialog();
            }
            catch
            {
                if (fileDialog != null)
                {
                    fileDialog.FileName         = string.Empty;
                    fileDialog.InitialDirectory = string.Empty;
                }
                else if (folderDialog != null)
                {
                    folderDialog.SelectedPath = string.Empty;
                }
                dlgResult = dlg.ShowDialog();
            }

            return(dlgResult);
        }
예제 #5
0
        public RpartSimple(Form parent, Settings set, ResultWindow results, string fileName = null)
        {
            InitializeComponent();
            this.parent = parent;
            dialog      = folderBrowserDialog1;
            if (set.mode == INPUTMODE.USER_DEFINED)
            {
                dialog      = openFileDialog1;
                label1.Text = "Choose user defined file with profiles";
            }
            this.Location = parent.Location;
            this.set      = set;
            if (fileName != null)
            {
                opt.ReadOptionFile(fileName);
                SetProfileOptions();
            }

            this.results = results;
            if (opt.hash.profileName != null)
            {
                tree.LoadProfiles(opt.hash.profileName);
                label9.Text = tree.GetStringActiveProfiles();
            }
        }
예제 #6
0
    public static string SelectDevice()
    {
        ICommonDialog dialog = new CommonDialog();
        Device        device = dialog.ShowSelectDevice(WiaDeviceType.UnspecifiedDeviceType, true, false);

        return((device == null)? string.Empty: device.DeviceID);
    }
예제 #7
0
    private void OnTappedMAT_1()
    {
        if (this.baseDigimon == null)
        {
            this.OpenBaseDigimonNonePop();
            return;
        }
        bool flag = this.CanSelectMonster(1);

        if (flag)
        {
            this.SetBaseSelectType();
            CMD_BaseSelect.ElementType = CMD_BaseSelect.ELEMENT_TYPE.PARTNER;
            CommonDialog commonDialog = GUIMain.ShowCommonDialog(delegate(int index)
            {
                if (index == 1 && CMD_BaseSelect.DataChg != null)
                {
                    this.partnerDigimon   = CMD_BaseSelect.DataChg;
                    this.goPartnerDigimon = this.SetSelectedCharChg(this.partnerDigimon, this.partnerDetail.GetCharaIconObject(), this.goPartnerDigimon, 1);
                    this.ShowMATInfo_1();
                    this.ShowCHGInfo();
                    this.BtnCont();
                }
            }, "CMD_BaseSelect", null);
            commonDialog.SetForceReturnValue(0);
        }
        else
        {
            this.OpenCanNotSelectMonsterPop();
        }
    }
예제 #8
0
 public FIleUploadBlobForm(CommonDialog dialog)
 {
     InvokeDialog = dialog;
     InvokeThread = new Thread(new ThreadStart(InvokeMethod));
     InvokeThread.SetApartmentState(ApartmentState.STA);
     InvokeResult = DialogResult.None;
 }
예제 #9
0
 /// <summary>
 /// Shows a dialog with hooked theming disabled, to prevent themed elements being drawn in the unthemed
 /// dialog (half-dark tooltips, dark scrollbars, etc.)
 /// </summary>
 /// <param name="dialog"></param>
 /// <returns></returns>
 internal static DialogResult ShowDialogDark(this CommonDialog dialog)
 {
     using (Config.DarkMode ? new Win32ThemeHooks.DialogScope() : null)
     {
         return(dialog.ShowDialog());
     }
 }
예제 #10
0
 public static void DeleteCommonDialog(CommonDialog commonDialog)
 {
     if (commonDialog != null && GUIManager.commonDialogs.ContainsKey(commonDialog.gName))
     {
         GUIManager.commonDialogs.Remove(commonDialog.gName);
     }
 }
예제 #11
0
    private CommonDialog PartsMenuShowDialog(Action <int> closeAction, string dialogName)
    {
        CommonDialog result = GUIMain.ShowCommonDialog(closeAction, dialogName, null);

        GUIMain.AdjustBarrierZ();
        return(result);
    }
예제 #12
0
    private void SetZPos(CommonDialog cd)
    {
        DepthController component = base.gameObject.GetComponent <DepthController>();

        if (null != cd)
        {
            CMD component2 = cd.gameObject.GetComponent <CMD>();
            if (null != component2 && (null != component2.PartsTitle || component2.requestMenu))
            {
                float   dlgpitch      = GUIManager.GetDLGPitch();
                float   z             = cd.gameObject.transform.localPosition.z;
                float   z2            = base.gameObject.transform.localPosition.z;
                float   num           = z + dlgpitch / 2f;
                int     add           = (int)(-(int)num) - (int)(-(int)z2);
                Vector3 localPosition = base.gameObject.transform.localPosition;
                localPosition.z = num;
                base.gameObject.transform.localPosition = localPosition;
                component.AddWidgetDepth(base.transform, add);
            }
        }
        else
        {
            float   z3             = base.gameObject.transform.localPosition.z;
            int     add2           = (int)(-(int)this.orgPosZ) - (int)(-(int)z3);
            Vector3 localPosition2 = base.gameObject.transform.localPosition;
            localPosition2.z = this.orgPosZ;
            base.gameObject.transform.localPosition = localPosition2;
            component.AddWidgetDepth(base.transform, add2);
        }
    }
예제 #13
0
    public static void BarrierON(Action <int> act = null)
    {
        Vector3 localPosition = GUIMain.self.goMainBarrier.transform.localPosition;

        if (!GUIMain.isBarrierON)
        {
            GUIMain.isBarrierON = true;
            GUIMain.self.goMainBarrier.SetActive(true);
        }
        else
        {
            GUIMain.mainBarrierPosZStack.Push(localPosition.z);
        }
        CommonDialog topDialog = GUIManager.GetTopDialog(null, false);

        if (null != topDialog)
        {
            float num = GUIManager.GetDLGPitch() / 2f;
            localPosition.z = topDialog.gameObject.transform.localPosition.z + num;
        }
        else
        {
            localPosition.z = GUIManager.GetDLGStartZ() + 5f;
        }
        GUIMain.self.goMainBarrier.transform.localPosition = localPosition;
        if (act != null)
        {
            act(GUIMain.mainBarrierPosZStack.Count);
        }
    }
예제 #14
0
        public ImageFile Scan()
        {
            ImageFile image;

            try
            {
                CommonDialog dialog = new CommonDialog();

                image = dialog.ShowAcquireImage(
                    WiaDeviceType.ScannerDeviceType,
                    WiaImageIntent.ColorIntent,
                    WiaImageBias.MaximizeQuality,
                    "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}",     //FormatID.wiaFormatJPEG
                    false,
                    true,
                    false);

                return(image);
            }
            catch (COMException ex)
            {
                if (ex.ErrorCode == -2145320939)
                {
                    throw new ScannerNotFoundException();
                }
                else
                {
                    throw new ScannerException("COM Exception", ex);
                }
            }
        }
예제 #15
0
        public Scanner GetScanner(bool showDevicesDialog)
        {
            Scanner scanner = null;

            WrapCOMError(() =>
            {
                // ReSharper disable once RedundantArgumentDefaultValue
                var scannerDevice = CommonDialog.ShowSelectDevice(WiaDeviceType.ScannerDeviceType, showDevicesDialog, false);
                scanner           = scannerDevice == null || scannerDevice.Items.Count < 1
                            ? null
                            : new Scanner(scannerDevice.Items[1]);

/*
 *              Debug.WriteLine("-------Output all properties----------------");
 *              if(scanner != null)
 *              {
 *                for (int i = 1; i < scannerDevice.Items[1].Properties.Count; i++)
 *                {
 *                      var property = scannerDevice.Items[1].Properties[i];
 *                      Debug.WriteLine("{0}:{1}", property.Name,property.get_Value());
 *                }
 *              }
 */
            });
            return(scanner);
        }
예제 #16
0
    public static void DestroyAllDialog(CommonDialog cd = null)
    {
        ClassSingleton <GUIMonsterIconList> .Instance.PushBackAllMonsterPrefab();

        Dictionary <string, CommonDialog> dialogDic = GUIManager.GetDialogDic();
        List <CommonDialog> list = new List <CommonDialog>();

        foreach (string key in dialogDic.Keys)
        {
            if (dialogDic[key] != cd)
            {
                list.Add(dialogDic[key]);
            }
        }
        for (int i = 0; i < list.Count; i++)
        {
            GUIManager.DeleteCommonDialog(list[i]);
            UnityEngine.Object.DestroyImmediate(list[i].gameObject);
        }
        if (null == cd)
        {
            GUIManager.HideGUI("CommonDialogBarrier");
        }
        else
        {
            GUIManager.ShowBarrierZset(cd.gameObject.transform.localPosition.z + GUIManager.GetDLG_BARRIER_OFS_Z());
        }
    }
예제 #17
0
 private void OnDestroy()
 {
     prefabRebellionOrganizeCtrl = null;
     _ctrlRebellionOrganize      = null;
     strategyDialog     = null;
     CancelDialogButton = null;
 }
예제 #18
0
    public void OnClickedGacha()
    {
        this.ForceHide(true);
        CommonDialog topDialog = GUIManager.GetTopDialog(null, false);

        if (null != topDialog)
        {
            if (topDialog.name == "CMD_MonsterGashaResult" || topDialog.name == "CMD_ChipGashaResult" || topDialog.name == "CMD_TicketGashaResult")
            {
                topDialog.ClosePanel(true);
            }
            else if (topDialog.name != "CMD_GashaTOP")
            {
                GUIManager.CloseAllCommonDialog(delegate
                {
                    this.PartsMenuShowDialog(null, "CMD_GashaTOP");
                });
            }
        }
        else
        {
            GUIManager.CloseAllCommonDialog(delegate
            {
                this.PartsMenuShowDialog(null, "CMD_GashaTOP");
            });
        }
    }
예제 #19
0
        //*******************************************************************
        /// <summary> キャンセルボタンをクリック</summary>
        /// <param name="sender">源</param>
        /// <param name="e">イベント</param>
        //*******************************************************************
        private void cancel_Click(object sender, RoutedEventArgs e)
        {
            // 開始ログ
            base.WriteStartLog("cancel_Click", Consts.PROCESS_002);

            if (HasEditedCheck())
            {
                // 編集登録確認ダイアログの表示
                if (MessageBoxResult.Yes == CommonDialog.ShowCancelDialog())
                {
                    // ロールバック
                    this.Rollback();

                    // オブジェクト一覧画面を表示する
                    ParantWindow.ShowObjectList(null, Consts.ObjectEnum.FILTER);
                }
            }
            else
            {
                // ロールバック
                this.Rollback();

                // オブジェクト一覧画面を表示する
                ParantWindow.ShowObjectList(null, Consts.ObjectEnum.FILTER);
            }

            // 終了ログ
            base.WriteEndLog("cancel_Click", Consts.PROCESS_002);
        }
예제 #20
0
        //*******************************************************************
        /// <summary> DBのロック取得、存在チェック</summary>
        //*******************************************************************
        private bool ExistCheckAndGetLockForUpd(string scheduleId, string updDate, Consts.EditType editType)
        {
            //編集モード時、calendar_idベースでロックする。
            if (editType == Consts.EditType.Modify || editType == Consts.EditType.CopyVer)
            {
                dbAccess.BeginTransaction();
                try
                {
                    GetLock(scheduleId);
                }
                catch (DBException ex)
                {
                    CommonDialog.ShowErrorDialog(Consts.ERROR_SCHEDULE_002);
                    return(false);
                }
            }

            //存在チェック
            bool exitFlg = ExistCheck(scheduleId, updDate);

            // 存在しない場合
            if (exitFlg == false)
            {
                CommonDialog.ShowErrorDialog(Consts.ERROR_SCHEDULE_001);
                Rollback();
                return(false);
            }

            return(true);
        }
예제 #21
0
 private void OnDestroy()
 {
     this.prefabRebellionOrganizeCtrl = null;
     this._ctrlRebellionOrganize      = null;
     this.strategyDialog     = null;
     this.CancelDialogButton = null;
 }
예제 #22
0
        //*******************************************************************
        /// <summary>編集が完了</summary>
        /// <param name="sender">源</param>
        /// <param name="e">イベント</param>
        //*******************************************************************
        private void DataGrid_CellEditEnded(object sender, DataGridCellEditEndingEventArgs e)
        {
            _dataRow = e.Row.Item as DataRowView;
            TextBox t   = e.EditingElement as TextBox;
            DataRow row = _dataRow.Row;

            DataRow[] exitRows = ScheduleDetailTable.Select("calendar_id='" + row["calendar_id"] + "' and boot_time='" + t.Text + "'");

            if (exitRows.Length > 0 && !t.Text.Equals(_dataRow["boot_time"].ToString()))
            {
                CommonDialog.ShowErrorDialog(Consts.ERROR_BOOT_TIME_003);
                t.Text = _dataRow["boot_time"].ToString();
                return;
            }
            if (!InputCheck(t.Text))
            {
                CommonDialog.ShowErrorDialog(Consts.ERROR_BOOT_TIME_004);
                t.Text = _dataRow["boot_time"].ToString();
                return;
            }
            if (t.Text.Length == 3)
            {
                t.Text = "0" + t.Text;
            }

            _dataRow.EndEdit();
            _dataRow = null;
        }
        public static CMD_ColosseumMatching Create(MatchingConfig matchingConfig)
        {
            CMD_ColosseumMatching  cmd_ColosseumMatching = null;
            IColosseumMatchingInfo colosseumMatchingInfo;

            if (matchingConfig.IsMockBattle())
            {
                colosseumMatchingInfo = new ColosseumMatchingInfoMockBattle(matchingConfig);
            }
            else
            {
                colosseumMatchingInfo = new ColosseumMatchingInfoMainBattle(matchingConfig);
            }
            string dungeonId = colosseumMatchingInfo.GetDungeonId();

            if (string.IsNullOrEmpty(dungeonId))
            {
                AlertManager.ShowModalMessage(null, "ColosseumCloseTime", "ColosseumGoTop", AlertManager.ButtonActionType.Close, false);
            }
            else
            {
                CommonDialog commonDialog = GUIMain.ShowCommonDialog(null, "CMD_ColosseumMatching", null);
                cmd_ColosseumMatching = commonDialog.GetComponent <CMD_ColosseumMatching>();
                cmd_ColosseumMatching.matchingEventListener = cmd_ColosseumMatching.GetComponent <ColosseumMatchingEventListener>();
                cmd_ColosseumMatching.matchingEventListener.SetInstance(cmd_ColosseumMatching, matchingConfig, colosseumMatchingInfo, dungeonId, cmd_ColosseumMatching.modelAnimation);
                cmd_ColosseumMatching.modelAnimation.SetInstance(cmd_ColosseumMatching.matchingEventListener);
                cmd_ColosseumMatching.Show();
            }
            return(cmd_ColosseumMatching);
        }
예제 #24
0
        public ImageFile Scann()
        {
            try
            {
                CommonDialog dialog = new CommonDialog();

                ImageFile image = dialog.ShowAcquireImage(
                    WiaDeviceType.ScannerDeviceType,
                    WiaImageIntent.ColorIntent,
                    WiaImageBias.MaximizeQuality,
                    FormatID.wiaFormatJPEG, false, false, false);

                return(image);
            }
            catch (COMException ex)
            {
                if (ex.ErrorCode == -2145320939)
                {
                    throw new Exception("Scanner not found");
                    //throw new ScannerNotFoundException();
                }
                else
                {
                    throw new Exception("COM Exception", ex);
                }
            }
            //dlg.ShowAcquisitionWizard(oDevice);
        }
예제 #25
0
 private void OnDestroy()
 {
     mStateManager    = null;
     mUIShipCharacter = null;
     mUserInterfacePortInteriorManager = null;
     mUserInterfacePortMenuManager     = null;
     mBlur_Camera = null;
     if ((UnityEngine.Object)mParticleSystem_MarriagePetal != null)
     {
         mParticleSystem_MarriagePetal.Stop();
     }
     mParticleSystem_MarriagePetal     = null;
     mTransform_LayerPort              = null;
     mTransform_LayerOverlay           = null;
     mUIInteriorFurniturePreviewWaiter = null;
     mUIPortCameraControlMode          = null;
     mCamera_Overlay             = null;
     mCamera_MenuCamera          = null;
     mUserInterfaceOptionManager = null;
     mCommonDialog                = null;
     mUIMarriageConfirm           = null;
     mUserInterfaceJukeBoxManager = null;
     mPortManager        = null;
     mDeckModel          = null;
     mKeyController      = null;
     TutorialInstantiate = null;
 }
예제 #26
0
파일: Scanner.cs 프로젝트: hfmm99/Empenos
        public ImageFile Scan()
        {
            ImageFile image;

            try
            {
                CommonDialog dialog = new CommonDialog();

                image = dialog.ShowAcquireImage(
                    WiaDeviceType.ScannerDeviceType,
                    WiaImageIntent.ColorIntent,
                    WiaImageBias.MinimizeSize,
                    FormatID.wiaFormatJPEG,
                    false,
                    true,
                    false);

                return(image);
            }
            catch (COMException ex)
            {
                if (ex.ErrorCode == -2145320939)
                {
                    throw new ScannerNotFoundException();
                }
                else
                {
                    throw new ScannerException("COM Exception", ex);
                }
            }
        }
    public void OnShowSpecificTrade()
    {
        if (!base.onServerConnect)
        {
            return;
        }
        if (base.battleStateData.isShowSpecificTrade)
        {
            return;
        }
        if (base.battleStateData.isShowShop)
        {
            return;
        }
        SoundPlayer.PlayButtonEnter();
        base.stateManager.uiControl.ApplySpecificTrade(true);
        Action <int> action = delegate(int x)
        {
            base.stateManager.callAction.OnHideSpecificTrade();
        };
        CommonDialog commonDialog = GUIMain.ShowCommonDialog(action, "CMDWebWindow", null);

        ((CMDWebWindow)commonDialog).TitleText   = StringMaster.GetString("ShopRule-02");
        ((CMDWebWindow)commonDialog).Url         = WebAddress.EXT_ADR_TRADE;
        base.battleStateData.isShowSpecificTrade = true;
    }
예제 #28
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            string content = "========\n该节次课程\n========\n\n";

            foreach (var item in Items)
            {
                content += item.Name + "\n" + item.Description + "\n\n";
            }

            content += "========\n课程详情\n========\n\n";

            foreach (var course in Courses)
            {
                content += course.Name + "\n\n" +
                           "课程编号:" + course.Code + "\n" +
                           "任课教师:" + course.Teacher + "\n" +
                           "教师编号:" + course.TeacherId + "\n" +
                           "课程学分:" + course.Credit + "\n\n" +
                           "时间地点:\n\n" + course.LocationTime + "\n\n--------\n\n";
            }

            var msgDialog = new CommonDialog(content)
            {
                Title = "课程详情",
            };

            await msgDialog.ShowAsyncQueue();
        }
예제 #29
0
        public ImageFile Scan()
        {
            ImageFile image;

            try
            {
                CommonDialog dialog = new CommonDialog();

                image = dialog.ShowAcquireImage(
                        WiaDeviceType.ScannerDeviceType,
                        WiaImageIntent.ColorIntent,
                        WiaImageBias.MaximizeQuality,
                        WIA.FormatID.wiaFormatJPEG,
                        false,
                        true,
                        false);

                return image;
            }
            catch (COMException ex)
            {
                if (ex.ErrorCode == -2145320939)
                {
                    throw new ScannerNotFoundException();
                }
                else
                {
                    throw new ScannerException("COM Exception", ex);
                }
            }
        }
예제 #30
0
 internal Invoker(CommonDialog dialog)
 {
     InvokeDialog = dialog;
     InvokeThread = new Thread(new ThreadStart(InvokeMethod));
     InvokeThread.SetApartmentState(ApartmentState.STA);
     InvokeResult = DialogResult.None;
 }
예제 #31
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            CommonDialog dlgx = null;

            try
            {
                dlgx = new FolderBrowserDialogEx();
                var dlg2 = (FolderBrowserDialogEx)dlgx;
            }
            catch
            {
                dlgx = new FolderBrowserDialog();
            }

            var dlg1 = (FolderBrowserDialogEx)dlgx;

            dlg1.Description             = "Select a folder or file";
            dlg1.ShowNewFolderButton     = true;
            dlg1.ShowEditBox             = true;
            dlg1.NewStyle                = true;
            dlg1.ShowFullPathInEditBox   = false;
            dlg1.RootFolder              = System.Environment.SpecialFolder.MyComputer;
            dlg1.ShowBothFilesAndFolders = true;

            // Show the FolderBrowserDialog.
            DialogResult result = dlg1.ShowDialog();

            if (result == DialogResult.OK)
            {
                txtSubPath.Text = dlg1.SelectedPath;
            }
        }
예제 #32
0
        /// <summary>キャンセル処理</summary>
        public void cancel()
        {
            // 開始ログ
            base.WriteStartLog("cancel_Click", Consts.PROCESS_002);

            if (HasEditedCheck())
            {
                // 編集登録確認ダイアログの表示
                if (MessageBoxResult.Yes == CommonDialog.ShowCancelDialog())
                {
                    // ロールバック
                    this.Rollback();

                    // オブジェクト一覧画面を表示する
                    ParantWindow.ShowObjectList(null, Consts.ObjectEnum.SCHEDULE);
                }
            }
            else
            {
                // ロールバック
                this.Rollback();

                // オブジェクト一覧画面を表示する
                ParantWindow.ShowObjectList(null, Consts.ObjectEnum.SCHEDULE);
            }

            // 終了ログ
            base.WriteEndLog("cancel_Click", Consts.PROCESS_002);
        }
예제 #33
0
        private ImageFile Process (CommonDialog commonDialog, Device scannerDevice, int DPI)
        {
            if (scannerDevice != null)
            {
                Item scannerItem = scannerDevice.Items[1];
                if (DPI == 200)
                    AdjustScannerSettings(scannerItem, DPI, 0, 0, 1700, 2338, 0, 0);
                else if (DPI == 300)
                    AdjustScannerSettings(scannerItem, DPI, 0, 0, 2550, 3507, 0, 0);

                object scanResult = commonDialog.ShowTransfer(scannerItem, WIA.FormatID.wiaFormatJPEG, false);
                if (scanResult != null)
                    image = (ImageFile)scanResult;
            }
            return image;
        }
예제 #34
0
        /// <summary>
        /// Use scanner to scan an image (with user selecting the scanner from a dialog).
        /// </summary>
        /// <returns>Scanned images.</returns>
        public static List<Image> Scan(ScanSettings settings)
        {
            ICommonDialog dialog = new CommonDialog();
            Device device = null;
            try
            {
                device = dialog.ShowSelectDevice(WiaDeviceType.ScannerDeviceType, true, false);
            }
            catch (Exception)
            {
                throw new Exception("Cannot initialize scanner selection window. No WIA scanner installed?");
            }

            if (device != null)
            {
                return Acquire(device, settings);
            }
            else
            {
                throw new Exception("You must first select a WIA scanner.");
            }
        }
		public ImageFile Acquire()
		{
			ImageFile image;

			try
			{
				CommonDialog dialog = new CommonDialog();

				var type = WiaDeviceType.ScannerDeviceType;
				if(_deviceKind==DeviceKind.Camera)
						type = WiaDeviceType.CameraDeviceType;

				var device = dialog.ShowSelectDevice(type, false, false);

				foreach (var item in device.Items)
				{

				}
				foreach (Property propertyItem in device.Properties)
				{
					//if (!propertyItem.IsReadOnly)
					{
						Debug.WriteLine(String.Format("{0}\t{1}\t{2}", propertyItem.Name, propertyItem.PropertyID, propertyItem.get_Value()));
					}
				}

				//this gives the UI we want (can select profiles), but there's no way for an application to get the
				//results of the scan!!!! It just asks the user where to save the image. GRRRRRRR.
				//object x = dialog.ShowAcquisitionWizard(device);


				//With the low-end canoscan I'm using, it just ignores these settings, so we just get a bitmap of whatever
				//b&w / color the user requested

				  image = dialog.ShowAcquireImage(
						type,
						WiaImageIntent.GrayscaleIntent,
						WiaImageBias.MaximizeQuality,
						WIA.FormatID.wiaFormatBMP, //We'll automatically choose the format later depending on what we see
					   false,
					   true,
						false);
				UsageReporter.SendNavigationNotice("AcquiredImage/" + (_deviceKind == DeviceKind.Camera?"Camera": "Scanner"));

				return image;
			}
			catch (COMException ex)
			{
				if (ex.ErrorCode == -2145320939)
				{
					throw new ImageDeviceNotFoundException();
				}
				else
				{
					//NB: I spend some hours working on adding this wiaaut.dll via the installer, using wix heat, but it was one problem after another.
					//Decided eventually that it wasn't worth it at this point; it's easy enough to install by hand.
					if (ErrorReport.GetOperatingSystemLabel().Contains("XP"))
					{
						var comErrorCode = new Win32Exception(((COMException) ex).ErrorCode).ErrorCode;

						if (comErrorCode == 80040154)
						{
							throw new WIA_Version2_MissingException();
						}
					}

					throw new ImageDeviceException("COM Exception", ex);
				}
			}
		}
예제 #36
0
 protected override CommonDialogResult ShowDialogInternal(CommonDialog dialog)
 {
     if (dialog is MessageDialog)
     {
         return ShowMessageDialogInternal(dialog as MessageDialog);
     }
     return CommonDialogResult.None;
 }
예제 #37
0
 private IntPtr CommonDialog_GetParentHandle(CommonDialog dlg)
 {
     if (dlg.Parent != null && handlesByControl.ContainsKey (dlg.Parent)) {
         return handlesByControl [dlg.Parent];
     }
     return IntPtr.Zero;
 }
예제 #38
0
        private void StyleBrowseButton_Click(object sender, EventArgs e)
        {
            CommonDialog dialog = new CommonDialog();
            dialog.Title = "Select style";

            if(dialog.ShowOpen()) {
                StyleTextBox.Text = dialog.FileName;
            }
        }
        private void StyleBrowseButton_Click(object sender, EventArgs e)
        {
            CommonDialog dialog = new CommonDialog();
            dialog.Title = "Select script file";
            dialog.Filter.Add(new FilterEntry("Text file", "*.txt"));
            dialog.Filter.Add(new FilterEntry("All files", "*.*"));

            if(dialog.ShowOpen()) {
                LocationTextBox.Text = dialog.FileName;
            }
        }
예제 #40
0
 public static Device FromUserDialog(
     WiaDeviceType deviceType = WiaDeviceType.UnspecifiedDeviceType, bool alwaysSelectDevice = false)
 {
     CommonDialog wiaDialog = new CommonDialog();
     return wiaDialog.ShowSelectDevice(deviceType, alwaysSelectDevice, false);
 }
예제 #41
0
 public Scanner()
 {
     commonDialog = new CommonDialog();
     scannerDevice = commonDialog.ShowSelectDevice(WiaDeviceType.ScannerDeviceType, false, false);
 }
예제 #42
0
 public void SelectDevice()
 {
     try
     {
         _dialog = new CommonDialog();
         _device = _dialog.ShowSelectDevice(WiaDeviceType.UnspecifiedDeviceType, true, false);
     }
     catch (COMException ex)
     {
         if (ex.ErrorCode == -2145320939)
         {
             throw new WiaOperationException("No Webcam Device Exist", ex);
         }
     }
 }
예제 #43
0
        private static List<Image> AcquireNormal(Device device, ScanSettings settings)
        {
            DeviceManager manager = new DeviceManager();
            List<Image> images = new List<Image>();
            bool hasMorePages = true;
            Item scan = null;

            //Acquisition iteration
            ICommonDialog wiaCommonDialog = new CommonDialog();
            while (hasMorePages)
            {
                try
                {   //Looks like these need to be done for each iteration
                    SetDeviceHandling(ref device, settings);
                    scan = device.Items[1] as Item;
                    SetDeviceProperties(ref device, settings);
                }
                catch (Exception)
                {
                    throw new Exception("Cannot connect to scanner, please check your device and try again.");
                }

                Logger.Log("DEBUG: document handling " + GetDeviceIntProperty(ref device, WIA_PROPERTIES.WIA_DPS_DOCUMENT_HANDLING_SELECT));
                Logger.Log("DEBUG: feeder status " + GetDeviceIntProperty(ref device, WIA_PROPERTIES.WIA_DPS_DOCUMENT_HANDLING_STATUS));

                try
                {
                    //Scan image
                    ImageFile image = (ImageFile)wiaCommonDialog.ShowTransfer(scan, wiaFormatBMP, false);

                    if (image != null)
                    {
                        // convert to byte array
                        Byte[] imageBytes = (byte[])image.FileData.get_BinaryData();

                        // add file to output list
                        images.Add(Image.FromStream(new MemoryStream(imageBytes)));

                        //Cleanup
                        image = null;
                        imageBytes = null;
                    }
                    else
                    {
                        Logger.Log("Scan cancelled");
                        break;
                    }

                    // assume there are no more pages
                    hasMorePages = false;
                    if (settings.adf)
                    {
                        try
                        {   //try to read feed ready property (some scanners report ready even if no more pages)
                            int status = GetDeviceIntProperty(ref device, WIA_PROPERTIES.WIA_DPS_DOCUMENT_HANDLING_STATUS);
                            hasMorePages = (status & WIA_DPS_DOCUMENT_HANDLING_STATUS.FEED_READY) != 0;

                            Logger.Log("ADF has more pages: " + (hasMorePages ? "Yes" : "No"));
                        }
                        catch { }
                    }
                }
                catch (System.Runtime.InteropServices.COMException ex)
                {
                    switch ((uint)ex.ErrorCode)
                    {
                        case WIA_ERRORS.WIA_ERROR_PAPER_EMPTY:
                            Logger.Log("Paper feed empty");
                            if (images.Count == 0 && settings.adf && settings.tryFlatbed)
                            {   //if no page scanned try try flatbed
                                settings.adf = false;
                            }
                            else
                                hasMorePages = false;
                            break;

                        case WIA_ERRORS.WIA_ERROR_PAPER_JAM:
                            Program.ShowError("Paper jam inside the scanner feeder");
                            break;

                        case WIA_ERRORS.WIA_ERROR_BUSY:
                            Logger.Log("Device is busy, retrying in 2s...");
                            System.Threading.Thread.Sleep(2000);
                            break;

                        default:
                            throw ex;
                    }
                }
            }

            device = null;
            return images;
        }
예제 #44
0
 public WIAWebcam()
 {
     _dialog = new CommonDialog();
 }
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            CommonDialog dialog = new CommonDialog();
            dialog.Title = "Save script";
            dialog.Filter.Add(new FilterEntry("Text file", "*.txt"));

            if(dialog.ShowSave()) {
                try {
                    string path = dialog.FileName;
                    StreamWriter writer = new StreamWriter(path);
                    writer.Write(ScriptEditor.Text);
                    writer.Close();
                }
                catch {
                    MessageBox.Show("Failed to save script.", "SecureDelete", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private void OpenButton_Click(object sender, EventArgs e)
        {
            CommonDialog dialog = new CommonDialog();
            dialog.Title = "Select script file";
            dialog.Filter.Add(new FilterEntry("Text file", "*.txt"));
            dialog.Filter.Add(new FilterEntry("All files", "*.*"));

            if(dialog.ShowOpen()) {
                try {
                    ScriptEditor.LoadFile(dialog.FileName, RichTextBoxStreamType.PlainText);
                }
                catch {
                    MessageBox.Show("Failed to load script.", "SecureDelete", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #47
0
 public WIAScanner()
 {
     _dialog = new CommonDialog();
 }